Default handler for _IO_STAT messages


#include <sys/iofunc.h>

int iofunc_stat_default( resmgr_context_t *ctp,
                         io_stat_t *msg,
                         iofunc_ocb_t *ocb );


A pointer to a resmgr_context_t structure that the resource-manager library uses to pass context information between functions.
A pointer to the io_stat_t structure that contains the message that the resource manager received; see below.
A pointer to the iofunc_ocb_t structure for the Open Control Block that was created when the client opened the resource.



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


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:

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:

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.
(QNX Neutrino 7.0 or later) 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.

The o* members are variants of a struct stat, corresponding to the requested form.


-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.


QNX Neutrino

Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes