Default handler for _IO_FDINFO messages
#include <sys/iomgr.h> int iofunc_fdinfo_default( resmgr_context_t * ctp, io_fdinfo_t * msg, iofunc_ocb_t * ocb );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_fdinfo_default() function provides the default handler for the client's iofdinfo() call, which is received as an _IO_FDINFO message by the resource manager.
You can place this function directly into the io_funcs table passed to resmgr_attach(), at the fdinfo position, or you can call iofunc_func_init() to initialize all of the functions to their default values.
The iofunc_fdinfo_default() function calls iofunc_fdinfo() and resmgr_pathname() to do the actual work.
The io_fdinfo_t structure holds the _IO_FDINFO message received by the resource manager:
struct _io_fdinfo { uint16_t type; uint16_t combine_len; uint32_t flags; int32_t path_len; uint32_t reserved; }; struct _io_fdinfo_reply { uint32_t zero[2]; struct _fdinfo info; /* char path[path_len + 1]; */ }; typedef union { struct _io_fdinfo i; struct _io_fdinfo_reply o; } io_fdinfo_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_fdinfo that contains the following members:
The o member is a structure of type _io_fdinfo_reply that contains the following members:
struct _fdinfo { uint32_t mode; /* File mode */ uint32_t ioflag; /* Current io flags */ uint64_t offset; /* Current seek position */ uint64_t size; /* Current size of file */ uint32_t flags; /* _FDINFO_* */ uint16_t sflag; /* Share flags */ uint16_t count; /* File use count */ uint16_t rcount; /* File reader count */ uint16_t wcount; /* File writer count */ uint16_t rlocks; /* Number of read locks */ uint16_t wlocks; /* Number of write locks */ uint32_t zero[6]; };
The commented-out declaration for path indicates that path_len + 1 bytes of data immediately follow the _io_fdinfo_reply structure.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
iofdinfo(), iofunc_fdinfo_default(), iofunc_func_init(), iofunc_ocb_t, resmgr_attach(), resmgr_context_t, resmgr_io_funcs_t, _RESMGR_NPARTS(), resmgr_pathname()
Resource Managers chapter of Getting Started with QNX Neutrino