![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
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 POSIX 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:
Any other device control messages return ENOTTY.
The io_devctl_t structure holds the _IO_ message received by the resource manager:
struct _io_devctl {
uint16_t type;
uint16_t combine_len;
int32_t dcmd;
int32_t nbytes;
int32_t zero;
/* char data[nbytes]; */
};
struct _io_devctl_reply {
uint32_t zero;
int32_t ret_val;
int32_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 |
fcntl(), iofunc_attr_t, iofunc_devctl_default(), iofunc_ocb_t, resmgr_context_t
Writing a Resource Manager chapter of the Programmer's Guide.
![]() |
![]() |
![]() |
![]() |