Go to main content

STREAMS Programming Guide

Exit Print View

Updated: November 2020
 
 

Flush Handling

All modules and drivers are expected to handle the flushing of messages. The user may cause data to be flushed of queued messages from a stream by the submission of an I_FLUSH ioctl(). Data may be flushed from the read side, write side, or both sides of a stream.

ioctl (fd, I_FLUSH, arg);

The following list describes the arguments that may be passed to M_FLUSH:

FLUSHR

Flushes read side of stream

FLUSHW

Flushes write queue

FLUSHRW

Flushes both read and write queues

In addition to being able to flush all the data from a queue, a specific band may be flushed using the I_FLUSHBAND ioctl(). For more information, see the ioctl(2) man page.

ioctl (fd, I_FLUSHBAND, bandp); 

The ioctl() is passed a pointer to a bandinfo structure. The bi_pri field indicates the band priority to be flushed (values from 0 to 255). The bi_flag field indicates the type of flush to do. The legal values for bi_flag are defined in Flush Handling. bandinfo has the following format:

struct bandinfo {
		unsigned char    bi_pri;
		int              bi_flag;
};

For more information about M_FLUSHBAND processing, how modules and drivers must handle flush band requests, see Flushing Priority Band.