STREAMS-UX Programmer's Guide (February 2007)
STREAMS IOCTL Commands
Overview
Appendix A
149
Setting both RMSGD and RMSGN is an error. RMSGD and RMSGN override NORM.
In addition, treatment of control messages by the stream head may be changed by setting the following flags
in arg:
RPROTNORM Fail read with EBADMSG if a control message is at the front of the stream head read queue.
This is the default behavior.
RPROTDAT Deliver the control portion of a message as data when a user issues read.
RPROTDIS Discard the control portion of a message, delivering any data portion, when a user issues a
read.
On failure, errno is set to the following value:
[EINVAL] The arg contains an illegal value.
I_STR
Constructs an internal STREAMS IOCTL message from the data pointed to by arg, and sends that message
downstream.
This mechanism is provided to send user IOCTL requests to downstream modules and drivers. It allows
information to be sent with the IOCTL, and will return to the user any information sent upstream by the
downstream recipient. The I_STR blocks until the system responds with either a positive or negative
acknowledgement message, or until the request “times out” after some period of time. If the request times out,
it fails with errno set to ETIME.
At most, one I_STR can be active on a stream. Further I_STR calls will block until the active I_STR completes
at the stream head. The default timeout intervals for these requests is 15 seconds. The O_NONBLOCK (see open
(2)) flags have no effect on this call.
To send requests downstream, arg must point to a strioctl structure which contains the following members:
int ic_cmd;
int ic_timout;
int ic_len;
char *ic_dp;
ic_cmd The internal IOCTL command intended for the downstream module or driver.
ic_timout The number of seconds (-1 =infinite, 0 = use default, >0 = as specified) an I_STR
request will wait for acknowledgement before timing out. The default timeout is infinite.
ic_len The number of bytes in the data argument.
ic_dp A pointer to the data argument.
The ic_len field has two uses; on input, it contains the length of the data argument passed in, and on return
from the command, it contains the number of bytes being returned to the user (the buffer pointed to by ic_dp
should be large enough to contain the maximum amount of data that any module or driver in the stream can
return).
The stream head will convert the information pointed to by strioctl structure to an internal IOCTL
command message and send it downstream.
On failure, the errno is set to one of the following values:
[EINVAL] The ic_len field is less than 0 (zero) bytes or larger than the maximum allowable size of the
data part of a message (ic_dp).
[EINVAL] The ic_timout field is less than -1.