iofunc_stat_default()
Default handler for _IO_STAT messages
Synopsis:
#include <sys/iofunc.h>
int iofunc_stat_default( resmgr_context_t *ctp,
                         io_stat_t *msg,
                         iofunc_ocb_t *ocb );
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_stat_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.
 
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The iofunc_stat_default() function implements POSIX semantics for the client's stat() or fstat() call, which is received as an _IO_STAT message by the resource manager.
You can place this function directly into the resmgr_io_funcs_t table passed as the io_funcs argument to resmgr_attach(), at the stat position, or you can call iofunc_func_init() to initialize all of the functions to their default values.
The iofunc_stat_default() function calls:
- iofunc_time_update(), to ensure that the time entries in the ocb->attr structure are current and valid
 - iofunc_stat_format() to construct a status entry based on the information in the ocb->attr structure.
 
The iofunc_stat_default() function returns (via the status argument to MsgReply()) the form of the stat structure.
io_stat_t structure
The io_stat_t structure holds the _IO_STAT message received by the resource manager:
struct _io_stat {
    uint16_t                    type;
    uint16_t                    combine_len;
    union {
       uint32_t                 zero;
       uint32_t                 format;
    };
};
typedef union {
    struct _io_stat             i;
    struct __stat_t32_2001      o_t32_2001;
    struct __stat_t32_2008      o_t32_2008;
    struct __stat_t64_2008      o_t64_2008;
    struct stat                 o;
} io_stat_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).
The i member is a structure of type _io_stat that contains the following members:
- type
 - _IO_STAT.
 - 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.
 - format
 - The form of the information; one of the following: 
- _STAT_FORM_UNSET — unknown; this is assumed to be the same as _STAT_FORM_T32_2001
 - _STAT_FORM_T32_2001 — 32-bit fields, POSIX 2001
 - _STAT_FORM_T32_2008 — 32-bit fields, POSIX 2008
 - _STAT_FORM_T64_2008 — 64-bit fields, POSIX 2008
 - _STAT_FORM_SYS_2008 — _STAT_FORM_T32_2008 in programs compiled for a 32-bit architecture, or _STAT_FORM_T64_2008 in programs compiled for a 64-bit architecture.
 - _STAT_FORM_PREFERRED — the preferred form: _STAT_FORM_T32_2001 in programs compiled for a 32-bit architecture, or _STAT_FORM_T64_2008 in programs compiled for a 64-bit architecture.
 
Note:The _STAT_FORM_UNSET, _STAT_FORM_T32_2001, and _STAT_FORM_T32_2008 values are legacy values for 32-bit targets and shouldn't be used in this release. Also, _STAT_FORM_SYS_2008 and _STAT_FORM_PREFERRED are always the same as _STAT_FORM_T64_2008 because only 64-bit targets are supported. 
The o* members are variants of a struct stat, corresponding to the requested form.
Returns:
-1, to indicate to the resource manager library that it should return one part from the ctp->iov structure (see resmgr_context_t) to the client, or an errno value if an error occurred.
Classification:
| Safety: | |
|---|---|
| Cancellation point | No | 
| Signal handler | Yes | 
| Thread | Yes | 
