HP-UX Reference (11i v1 05/09) - 7 Device (Special) Files, 9 General Information, Index (vol 10)
s
streamio(7) streamio(7)
In addition, treatment of control messages by the stream head may be changed by set-
ting 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
.
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.
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 con-
tains the following members:
int ic_cmd;
int ic_timeout;
int ic_len;
char *ic_dp;
ic_cmd
is the internal ioctl command intended for the downstream module or
driver and ic_timeout is 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 is the number of bytes in the data argument and
ic_dp is 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 com-
mand, 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 mes-
sage and send it downstream.
I_SWROPT Sets the write mode using the value of the argument arg. Legal bit settings for arg
are:
SNDZERO Sends a zero-length message downstream when a write of 0
bytes occurs. To not send a zero-length message when a write of
0 bytes occurs, this bit must not be set in arg.
I_UNLINK Disconnects the two streams specified by fildes and arg. fildes is the file descriptor of
the stream connected to the multiplexing driver. arg is the multiplexor ID number
that was returned by the I_LINK.Ifarg is MUXID_ALL, then all streams which
were linked to fildes are disconnected. As in I_LINK, this command requires the
multiplexing driver to acknowledge the unlink.
RETURN VALUE
Unless specified differently for a command, the return value for a STREAMS ioctl() call is 0 (zero) on
success and −1 (minus one) on failure.
ERRORS
A STREAMS ioctl command fails without performing the function and with errno set to [EINVAL] if:
• The stream referred to by fildes is linked below a multiplexing driver.
HP-UX 11i Version 1: September 2005 − 6 − Hewlett-Packard Company Section 7−−159