SVR5 and SCO OpenServer 5


iocblk -- STREAMS ioctl structure


   #include <sys/stream.h>
   #include <sys/ddi.h>


The iocblk structure describes a user's M_IOCTL(D7str) request.


The iocblk structure is used in M_IOCTL(D7str), M_IOCACK(D7str), and M_IOCNAK(D7str) message types Modules and drivers usually convert M_IOCTL messages into M_IOCACK or M_IOCNAK messages by changing the type and updating the relevant members in the iocblk structure.

Data cannot be copied to the user's buffer with an M_IOCACK message if the ioctl is transparent in HDK Technical Reference.

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(D4str) structure. The stream head guarantees that the message is large enough to contain either structure.

DDI structure definitions

The DDI iocblk structure contains the following members:
   int	ioc_cmd;
   cred_t	*ioc_cr;
   uint_t	ioc_id;
   uint_t	ioc_count;
   int	ioc_error;
   int	ioc_rval;

ODDI structure definitions

The ODDI iocblk structure contains the following members:
   int ioc_cmd;
   ushort ioc_uid;
   ushort ioc_gid;
   uint ioc_id;	
   uint ioc_count;	
   int ioc_error;
   int ioc_rval;

Structure members

the ioctl command request specified by the user.

contains a pointer to the user credentials. (DDI only)

effective UID for the user sending the ioctl. (ODDI only).

effective GID for the user sending the ioctl. (ODDI only).

The ODDI ioc_uid and ioc_gid structure members correspond to the DDI ioc_cr member in the SVR5 structure. In SVR5, these values are #defined for accessing the same information from within the ioc_cr member. Note that these members can be tested to determine if the user issuing the ioctl call can be authorized to do so, and should not be modified.

ioctl ID, used to uniquely identify the ioctl request in the stream.

specifies the amount of user data contained in the M_IOCTL message. User data appears in M_DATA message blocks linked to the M_IOCTL message block. If ioc_countis 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 member specifies the amount of data to copy back to the user's buffer.

can be used to set an error for either an M_IOCACK or an M_IOCNAK message.

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.

Hardware applicability


Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 8, 8mp
oddi: 1, 2, 2mp, 3, 3mp, 4, 4mp, 5, 5mp


copyreq(D4str), copyresp(D4str), datab(D4str), Intro(D7str), M_COPYIN(D7str), M_COPYOUT(D7str), M_IOCTL(D7str), M_IOCACK(D7str), M_IOCNAK(D7str), msgb(D4str)

``STREAMS ioctls'' in HDK Technical Reference

19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005