STREAMS-UX Programmer's Guide (February 2007)

STREAMS IOCTL Commands
Overview
Appendix A
142
If a pipe does not have any modules pushed, the read queue of the stream head on either end is flushed
depending on the value of arg.
If FLUSHR is set and fildes is a pipe, the read queue for that end of the pipe is flushed and the write queue for
the other end is flushed.
If FLUSHW is set, the read queue for the other end of the pipe is flushed and the write queue for this end is
flushed.
If FLUSHRW is set, the read queue of both ends of the pipe are flushed.
Correct flush handling of a pipe with modules pushed is achieved via the pipemod module. This module
should be the first module pushed onto a pipe so that it is at the midpoint of the pipe itself.
On failure, errno is set to one of the following values:
[ENOSR] Could not allocate buffers for flush operation because of a lack of STREAMS memory
resources.
[EINVAL] The arg parameter is an invalid value.
[ENXIO] A hangup was received on fildes.
I_FLUSHBAND
This command flushes a particular band of messages. The arg points to a bandinfo structure, that has the
following members:
unsigned char bi_pri;
int bi_option;
The value of the bi_option field can be FLUSHR, FLUSHW, or FLUSHRW as described for the I_FLUSH command.
On failure, errno is set to the following value:
[EINVAL] The bi_pr parameter value exceeds the maximum band, or the bi_option parameter is
not FLUSHR, FLUSHW or FLUSHRW.
I_GETBAND
This command returns the priority band of the first message on the stream head read queue in the integer
referenced by arg.
On failure, errno is set to the following value:
[ENODATA]. No message exists on the stream head read queue.
I_GETCLTIME
This command returns the close time delay in the long integer pointed to by arg.
I_SETCLTIME
This command allows the user to set the time that the stream head will delay when a stream is closing, and
there is data on the write queues. Before closing each module and driver, the stream head will delay for the
specified amount of time to allow the data to drain. If, after the delay, data is still present, data will be
flushed. The arg is a pointer to the number of milliseconds to delay, rounded up to the nearest valid value on
the system. The default is fifteen seconds.