Handle an _IO_DEVCTL message
#include <sys/iofunc.h> int iofunc_devctl( resmgr_context_t *ctp, io_devctl_t *msg, iofunc_ocb_t *ocb, iofunc_attr_t *attr );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The iofunc_devctl() helper function implements the semantics for the client's devctl() call, which is received as an _IO_DEVCTL message by the resource manager. This function handles the DCMD_ALL* functionality.
This function handles at least the following device control messages:
The supported mount flags (bitmask values) for DCMD_ALL_GETMOUNTFLAGS include:
If iofunc_devctl() doesn't recognize the command, it returns _RESMGR_DEFAULT, so that your resource manager can process it. If you don't handle the command, the client library's devctl() returns ENOTTY.
io_devctl_t structure
The io_devctl_t structure holds the _IO_DEVCTL message received by the resource manager:
struct _io_devctl { uint16_t type; uint16_t combine_len; int32_t dcmd; uint32_t nbytes; int32_t zero; /* char data[nbytes]; */ }; struct _io_devctl_reply { uint32_t zero; int32_t ret_val; uint32_t nbytes; int32_t zero2; /* char data[nbytes]; */ } ; typedef union { struct _io_devctl i; struct _io_devctl_reply o; } io_devctl_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_devctl that contains the following members:
The commented-out declaration for data indicates that nbytes bytes of data immediately follow the _io_devctl structure.
The _DEVCTL_DATA() macro gets a pointer to the data that follows the message. Call it like this:
data = _DEVCTL_DATA (msg->i);
The o member of the io_devctl_t message is a structure of type _io_devctl_reply that contains the following members:
The commented-out declaration for data indicates that nbytes bytes of data immediately follow the _io_devctl_reply structure.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |