iofunc_utime()

Update time stamps

Synopsis:

#include <sys/iofunc.h>

int iofunc_utime( resmgr_context_t* ctp,
                  io_utime_t* msg,
                  iofunc_ocb_t* ocb,
                  iofunc_attr_t* attr );

Arguments:

ctp
A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
msg
A pointer to the io_utime_t structure that contains the message that the resource manager received; see below.
ocb
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.
attr
A pointer to the iofunc_attr_t structure that describes the characteristics of the device that's associated with your resource manager.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The iofunc_utime() helper function examines the flags member in the passed attr structure and sets the IOFUNC_ATTR_ATIME and IOFUNC_ATTR_MTIME bits if requested.

The function sets the IOFUNC_ATTR_CTIME and IOFUNC_ATTR_DIRTY_TIME bits. It then calls iofunc_time_update() to update the file times.

io_utime_t structure

The io_utime_t structure holds the _IO_UTIME or _IO_UTIME64 message received by the resource manager:

struct _io_utime {
    uint16_t                    type;
    uint16_t                    combine_len;
    int32_t                     cur_flag;
    struct __utimbuf32          times;
};

struct _io_utime64 {
    uint16_t                    type;
    uint16_t                    combine_len;
    int32_t                     cur_flag;
    int64_t                     atime_s;
    int64_t                     atime_ns;
    int64_t                     mtime_s;
    int64_t                     mtime_ns;
};

typedef union {
    struct _io_utime            i;
    struct _io_utime            i64;
} io_utime_t;

The I/O message structures are unions of an input message (coming to the resource manager) and an output or reply message (going back to the client). In this case, there's only an input message, i or i64, that contains the following members:

type
_IO_UTIME or _IO_UTIME64.
combine_len
If the message is a combine message, _IO_COMBINE_FLAG is set in this member. For more information, see Combine Messages chapter of Writing a Resource Manager.
cur_flag
If set, iofunc_utime() ignores the times member, and set the appropriate file times to the current time.
times
(_IO_UTIME only) A __utimbuf32 structure that specifies the time to use when setting the file times. For more information about this structure, see utime().
atime_s, atime_ns, mtime_s, mtime_ns
(_IO_UTIME64 only) The times, in seconds and nanoseconds, to use when setting the file access and modification times.

If the access or modification time is zero, the time is set to the current time.

Returns:

EOK
Successful completion.
EACCES
The client doesn't have permissions to do the operation.
EINVAL
The number of nanoseconds specified in atime_ns or mtime_ns is invalid.
EOVERFLOW
The number of seconds specified in atime_s or mtime_s won't fit into a time_t.
EPERM
The group ID or owner ID didn't match.
EROFS
The filesystem is read-only.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes