Asynchronous Input and Output
poll(2) enables
a user to monitor multiple streams synchronously. poll(2) normally
blocks until an event occurs on any of the polled file descriptors. In some applications,
however, you want to process incoming data asynchronously. For example, an application
can attempt to do some local processing and be interrupted when a pending event occurs.
Some time-critical applications must not block, and must have immediate success or
failure indication.
The I_SETSIG ioctl(2) (see streamio(7I))
is used to request that a SIGPOLL signal be sent to a user process
when a specific event occurs. Table 3–5 lists
events for I_SETSIG. These are similar to those described for poll(2).
Table 3–5
I_SETSIG ioctl(2) Events
Event
|
Description
|
S_INPUT
|
A message other than a high-priority message
has arrived on a stream head read queue. This event is maintained for compatibility
with the previous releases of the Solaris operating environment.
|
S_RDNORM
|
A normal (nonpriority) message has arrived
on the stream head read queue.
|
S_RDBAND
|
A priority message (band > 0) has arrived
on the stream head read queue.
|
S_HIPRI
|
A high-priority message has arrived on the
stream head read queue.
|
S_OUTPUT
|
A write queue for normal data (priority
band = 0) is no longer full (not flow controlled). This notifies a user that there
is space on the queue for sending or writing normal data downstream.
|
S_WRNORM
|
The same as S_OUTPUT.
|
S_WRBAND
|
A priority band greater than 0 of a queue
downstream exists and is writable. This notifies a user that there is space on the
queue for sending or writing priority data downstream.
|
S_MSG
|
A signal message sent from a module or driver
has arrived on the stream head read queue.
|
S_ERROR
|
An error message reaches the stream head.
|
S_HANGUP
|
A hangup message sent from a module or driver
has arrived at the stream head.
|
S_BANDURG
|
When used with S_RDBAND, SIGURG is generated instead of SIGPOLL when a priority
message reaches the front of the stream head read queue.
|
S_INPUT, S_RDNORM, S_RDBAND, and S_HIPRI are set even if the message is of zero length. A user process can
handle only high-priority messages by setting the arg to S_HIPRI.