1pipemod(7M)                     STREAMS Modules                    pipemod(7M)
2
3
4

NAME

6       pipemod - STREAMS pipe flushing module
7

DESCRIPTION

9       The  typical  stream  is composed of a stream head connected to modules
10       and terminated by a driver. Some stream configurations  such  as  pipes
11       and FIFOs do not have a driver and hence certain features commonly sup‐
12       ported by the driver need to be provided by other  means.  Flushing  is
13       one such feature, and it is provided by the pipemod module.
14
15
16       Pipes  and  FIFOs  in  their  simplest  configurations only have stream
17       heads. A write side is connected to a read side. This remains true when
18       modules are pushed. The twist occurs at a point known as the mid-point.
19       When an M_FLUSH message is passed from a write queue to  a  read  queue
20       the  FLUSHR  and/or FLUSHW bits have to be switched. The mid-point of a
21       pipe is not always easily detectable, especially if there are  numerous
22       modules  pushed  on either end of the pipe. In that case there needs to
23       be a mechanism to intercept all message passing through the stream.  If
24       the message is an M_FLUSH message and it is at the mid-point, the flush
25       bits need to be switched. This bit switching is handled by the  pipemod
26       module.
27
28
29       pipemod should be pushed onto a pipe or FIFO where flushing of any kind
30       will take place. The pipemod module can be pushed on either end of  the
31       pipe. The only requirement is that it is pushed onto an end that previ‐
32       ously did not have modules on it. That is, pipemod must  be  the  first
33       module  pushed  onto  a pipe so that it is at the mid-point of the pipe
34       itself.
35
36
37       The pipemod module handles only M_FLUSH messages.  All  other  messages
38       are  passed  on to the next module using the putnext() utility routine.
39       If an M_FLUSH message is passed to pipemod and the  FLUSHR  and  FLUSHW
40       bits  are  set,  the message is not processed but is passed to the next
41       module using the putnext() routine. If only the FLUSHR bit is set,  the
42       FLUSHR bit is turned off and the FLUSHW bit is set. The message is then
43       passed on to the next module using putnext(). Similarly, if the  FLUSHW
44       bit  is  the  only  bit  set  in the M_FLUSH message, the FLUSHW bit is
45       turned off and the FLUSHR bit is turned on. The message is then  passed
46       to the next module on the stream.
47
48
49       The  pipemod  module  can  be pushed on any stream that desires the bit
50       switching. It must be pushed onto a pipe or FIFO if any form of  flush‐
51       ing must take place.
52

SEE ALSO

54       STREAMS Programming Guide
55
56
57
58SunOS 5.11                        21 Aug 1992                      pipemod(7M)
Impressum