man(1) Manual page archive

     PIPE(2)                                                   PIPE(2)

          pipe - create an interprocess channel

          int fildes[2];

          The returned file descriptors are the ends of pair of
          cross-connected streams (See stream(4)). Data written via
          fildes[1] is available for reading via fildes[0] and vice

          It is assumed that after the pipe has been set up, two (or
          more) cooperating processes (created by subsequent fork
          calls) will pass data through the pipe with read and write
          calls.  The record structure induced by write calls is main-
          tained by a pipe and is visible to a reader, provided no
          line disciplines modules have been pushed into the pipe
          stream; see write(2).

          The Shell has a syntax to set up a linear array of processes
          connected by pipes.

          Write calls on a one-ended pipe raise signal SIGPIPE.  Read
          calls on a one-ended pipe with no data in it return an end-
          of-file for the first several attempts, then raise SIGPIPE.

          sh(1), read(2), write(2), fork(2)

          The function value zero is returned if the pipe was created;
          -1 if too many files are already open.

          Should too much buffering be necessary in any pipeline among
          a loop of processes, deadlock will occur.