STREAMS Modules pipemod(7M)
NAME
pipemod - STREAMS pipe flushing module
DESCRIPTION
The typical stream is composed of a stream head connected tomodules and terminated by a driver. Some stream configura-
tions such as pipes and FIFOs 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, andit is provided by the pipemod module.
Pipes and FIFOs 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 apoint known as the mid-point. When an M_FLUSH message is
passed from a write queue to a read queue the FLUSHR and/orFLUSHW 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 messagepassing through the stream. If the message is an M_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 requirement is that it is pushed onto an end that previously did not havemodules 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 put-
next() utility routine. If an M_FLUSH message is passed to
pipemod and the FLUSHR and FLUSHW bits are set, the message
is not processed but is passed to the next module using the putnext() routine. If only the FLUSHR bit is set, the FLUSHR bit is turned off and the FLUSHW bit is set. The message isthen passed on to the next module using putnext(). Simi-
larly, if the FLUSHW bit is the only bit set in the M_FLUSH
message, the FLUSHW bit is turned off and the FLUSHR bit is turned on. The message is then passed 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 ifSunOS 5.11 Last change: 21 Aug 1992 1
STREAMS Modules pipemod(7M)
any form of flushing must take place.SEE ALSO
STREAMS Programming GuideSunOS 5.11 Last change: 21 Aug 1992 2