iofunc_fdinfo_default()
Default handler for _IO_FDINFO messages
Synopsis:
#include <sys/iomgr.h>
int iofunc_fdinfo_default( resmgr_context_t * ctp,
io_fdinfo_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_fdinfo_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_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 resmgr_io_funcs_t table passed as the io_funcs argument 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.
io_fdinfo_t structure
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;
uint32_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:
- type
- _IO_FDINFO.
- 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.
- flags
- Currently, no flags are supported. Pass in 0 for this field.
- path_len
- The size of the path reply buffers that follow the reply.
The o member is a structure of type _io_fdinfo_reply that contains the following members:
- info
- A _fdinfo structure that's defined (in
<sys/iomgr.h>) as:
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.
Returns:
- -1
- Success; the resource manager library returns the result of _RESMGR_NPARTS(1), which evaluates to -1, because QNX OS uses a one-part IOV to store the server attributes requested by the client.
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | Yes |
Thread | Yes |