iocblk(D4DK) —
NAME
iocblk − STREAMS ioctl structure
SYNOPSIS
#include <sys/stream.h>
DESCRIPTION
The iocblk structure describes a user’s ioctl(2) request. It is used in M_IOCTL, M_IOCACK, and M_IOCNAK messages. Modules and drivers usually convert M_IOCTL messages into M_IOCACK or M_IOCNAK messages by changing the type and updating the relevant fields in the iocblk structure. When processing a transparent ioctl, the iocblk structure is usually overlaid with a copyreq(D4DK) structure. The stream head guarantees that the message is large enough to contain either structure.
STRUCTURE MEMBERS
| int | ioc_cmd; | /∗ ioctl command ∗/ |
| cred_t | ∗ioc_cr; | /∗ user credentials ∗/ |
| uint_t | ioc_id; | /∗ ioctl ID ∗/ |
| uint_t | ioc_count; | /∗ number of bytes of data ∗/ |
| int | ioc_error; | /∗ error code for M_IOCACK or M_IOCNAK ∗/ |
| int | ioc_rval; | /∗ return value for M_IOCACK ∗/ |
The ioc_cmd field is the ioctl command request specified by the user.
The ioc_cr field contains a pointer to the user credentials.
The ioc_id field is the ioctl ID, used to uniquely identify the ioctl request in the stream.
The ioc_count field specifies the amount of user data contained in the M_IOCTL message. User data will appear in M_DATA message blocks linked to the M_IOCTL message block. If ioc_count is set to the special value TRANSPARENT, then the ioctl request is “transparent.” This means that the user did not use the I_STR format of STREAMS ioctls and the module or driver will have to obtain any user data with M_COPYIN messages, and change any user data with M_COPYOUT messages. In this case, the M_DATA message block linked to the M_IOCTL message block contains the value of the arg parameter in the ioctl system call. For an M_IOCACK message, the ioc_count field specifies the amount of data to copy back to the user’s buffer.
The ioc_error field can be used to set an error for either an M_IOCACK or an M_IOCNAK message.
The ioc_rval field can be used to set the return value in an M_IOCACK message. This will be returned to the user as the return value for the ioctl system call that generated the request.
NOTES
Data cannot be copied to the user’s buffer with an M_IOCACK message if the ioctl is transparent.
No data can be copied to the user’s buffer with an M_IOCNAK message.
SEE ALSO
Programmer’s Guide: STREAMS
datab(D4DK), msgb(D4DK), copyreq(D4DK), copyresp(D4DK), messages(D5DK)
DDI/DKI — STREAMS