man(1) Manual page archive


     PIPE(2)                                                   PIPE(2)

     NAME
          pipe - create an interprocess channel

     SYNOPSIS
          int pipe(fildes)
          int fildes[2];

     DESCRIPTION
          Pipe creates a buffered channel for interprocess I/O commu-
          nication.  Two file descriptors returned in fildes 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 versa.

          After the pipe has been set up, cooperating processes cre-
          ated by subsequent fork(2) calls may pass data through the
          pipe with read and write calls.  The bytes placed on a pipe
          by one write are contiguous even if many process are writ-
          ing.  Writes induce a record structure: a read will not
          return bytes from more than one write; see read(2).

          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,
          and eventually SIGKILL.

     SEE ALSO
          sh(1), fork(2), read(2), select(2), stream(4)

     DIAGNOSTICS
          EIO, EMFILE, ENFILE, ENXIO

     BUGS
          Buffering in pipes connecting multiple processes may cause
          deadlocks.

          Some line discipline modules discard the record delimiters
          inserted by write.

          On many other versions of the system, only fildes[0] may be
          read and only fildes[1] may be written.