STREAMS-UX Programmer's Guide (February 2007)

STREAMS IOCTL Commands
Overview
Appendix A
148
I_SETSIG
Informs the stream head that the user wants the kernel to issue the SIGPOLL signal (see signal (2)) when a
particular event has occurred on the stream associated with fildes. The I_SETSIG supports an asynchronous
processing capability in STREAMS. The value of arg is a bitmask that specifies the events for which the user
should be signaled. It is the bitwise-OR of any combination, except where noted, of the following constants:
S_BANDURG When used in conjunction with S_RDBAND, SIGURG is generated instead of SIGPOLL when a
priority message reaches the front of the stream head read queue.
S_ERROR An M_ERROR message has reached the stream head.
S_HANGUP An M_HANGUP message has reached the stream head.
S_HIPRI A high priority message is present on the stream head read queue. This is set even if the
message is of zero length.
S_INPUT Any message other than an M_PCPROTO has arrived on a stream head read queue. This
event is maintained for compatibility with prior releases. This is set even if the message is
of zero length.
S_MSG A STREAMS signal message that contains the SIGPOLL signal has reached the front of the
stream head read queue.
S_OUTPUT The write queue just below the stream head is no longer full. This notifies the user that
there is room on the queue for sending (or writing) data downstream.
S_RDBAND A priority band message (band > 0) has arrived on a stream head read queue. This is set
even if the message is of zero-length.
S_RDNORM An ordinary (non-priority) message has arrived on a stream head read queue. This is set
even if the message is of zero-length.
S_WRBAND A priority band greater than 0 of a queue downstream exists and is writable. This notifies
the user that there is room on the queue for sending (or writing) priority data downstream.
S_WRNORM This event is the same as S_OUTPUT.
A user process may choose to be signaled only of high priority messages by setting arg bitmask to the value
S_HIPRI.
Processes that want to receive SIGPOLL signals must explicitly register to receive them using I_SETSIG. If
several processes register to receive the signal for the same event on the same stream, each process will be
signaled when the event occurs.
If the value of arg is zero, the calling process will be unregistered and will not receive further SIGPOLL
signals.
On failure, the errno is set to one of the following values:
[EINVAL] The user process is not registered to receive the SIGPOLL signal.
[EAGAIN] A data structure to store the signal request could not be allocated.
I_SRDOPT
Sets the read mode (see read (2)) using the value of the argument arg. Valid arg values are:
RNORM Byte-stream mode (default).
RMSGD Message-discard mode.
RMSGN Message-nondiscard mode.