|
|
An M_FLUSH can originate at the Stream head or in any module or driver. The first byte of the message contains flags that specify one of the following actions:
Drivers are expected to include the following processing for M_FLUSH messages: when an M_FLUSH message is sent downstream through the write queues in a Stream, the driver at the Stream end discards it if the message action indicates that the read queues in the Stream are not to be flushed (only FLUSHW set). If the message indicates that the read queues are to be flushed, the driver sets the M_FLUSH message flag to FLUSHR and then sends the message up the Stream's read queues. When a flush message is sent up a Stream's read side, the Stream head checks to see if the write side of the Stream is to be flushed. If only FLUSHR is set, the Stream head discards the message. However, if the write side of the Stream is to be flushed, the Stream head sets the M_FLUSH flag to FLUSHW and sends the message down the Stream's write side.
If FLUSHBAND is set, the second byte of the message contains the value of the priority band to flush. Call flushband(D3str) instead of flushq(D3str) when FLUSHBAND is set. flushband( ) contains an additional second argument that matches the second byte of the message and indicates the band to flush. This flag should be used only for modules that need to process priority banded messages correctly; for most STREAMS drivers and modules, flushing the entire queue is sufficient.