Technical data

pipemod(7M) STREAMS Modules SunOS 5.5
NAME pipemod STREAMS pipe flushing module
DESCRIPTION The typical stream is composed of a stream head connected to modules and terminated
by a driver. Some stream configurations such as pipes andFIFOs do not have a driver
and hence certain features commonly supported by the driver need to be provided by
other means. Flushing is one such feature, and it is provided by the pipemod module.
Pipes andFIFOs in their simplest configurations only have stream heads. A write side is
connected to a read side. This remains true when modules are pushed. The twist occurs
at a point known as the mid-point. When an M_FLUSH message is passed from a write
queue to a read queue theFLUSHR and/or FLUSHW bits have to be switched. The mid-
point of a pipe is not always easily detectable, especially if there are numerous modules
pushed on either end of the pipe. In that case there needs to be a mechanism to intercept
all message passing through the stream. If the message is anM_FLUSH message and it is
at the mid-point, the flush bits need to be switched. This bit switching is handled by the
pipemod module.
pipemod should be pushed onto a pipe or FIFO where flushing of any kind will take
place. The pipemod module can be pushed on either end of the pipe. The only require-
ment is that it is pushed onto an end that previously did not have modules on it. That is,
pipemod must be the first module pushed onto a pipe so that it is at the mid-point of the
pipe itself.
The pipemod module handles only M_FLUSH messages. All other messages are passed
on to the next module using the putnext() utility routine. If an M_FLUSH message is
passed to pipemod and theFLUSHR andFLUSHW bits are set, the message is not pro-
cessed but is passed to the next module using the putnext() routine. If only the FLUSHR
bit is set, theFLUSHR bit is turned off and the FLUSHW bit is set. The message is then
passed on to the next module using putnext(). Similarly, if the FLUSHW bit is the only bit
set in theM_FLUSH message, the FLUSHW bit is turned off and theFLUSHR bit is turned
on. The message is thenpassed to the next module on the stream.
The pipemod module can be pushed on any stream that desires the bit switching. It
must be pushed onto a pipe or FIFO if any form of flushing must take place.
SEE ALSO STREAMS Programming Guide
7M-258 modified 21 Aug 1992