iocblk(D4) iocblk(D4)
NAME
iocblk - STREAMS ioctl structure
SYNOPSIS
#include <sys/stream.h>
#include <sys/ddi.h>
DESCRIPTION
The iocblk structure describes a user's ioctl(2) request.
USAGE
The iocblk structure 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.
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.
When processing a transparent ioctl, the iocblk structure is
usually overlaid with a copyreq(D4) structure. The stream
head guarantees that the message is large enough to contain
either structure.
Structure Definitions
The iocblk structure contains the following 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.
Copyright 1994 Novell, Inc. Page 1
iocblk(D4) iocblk(D4)
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.
REFERENCES
copyreq(D4), copyresp(D4), datab(D4), messages(D5), msgb(D4)
NOTICES
Portability
All processors
Copyright 1994 Novell, Inc. Page 2