Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pipe(2) — UTek W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fork(2)

read(2)

sh(1sh)

socketpair(2)

write(2)



PIPE(2)                 COMMAND REFERENCE                 PIPE(2)



NAME
     pipe - create an interprocess communication channel

SYNOPSIS
     pipe(fd)
     int fd[2];

DESCRIPTION
     The pipe system call creates an I/O mechanism called a pipe.
     Pipe returns two file descriptors in fd[].  Fd[0] is opened
     for reading, and fd[1] is opened for writing.  When the pipe
     is written using fd[1] up to MINBSIZE (defined in
     <sys/fs.h>) bytes of data are buffered before the writing
     process is blocked.  A read using fd[0] will pick up the
     data.

     It is assumed that after the pipe has been set up, two (or
     more) cooperating processes (created by subsequent fork(2)
     calls) will pass data through the pipe with read(2) and
     write(2) calls.

     The shell has a syntax to set up a linear array of processes
     connected by pipes.  See sh(1sh).

     Read calls on an empty pipe (no buffered data) with only one
     end (all write file descriptors closed) returns an end-of-
     file.

     Pipes are really a special case of the socketpair(2) call
     and, in fact, are implemented as such in the system.

     A signal (SIGPIPE) is generated if a write on a pipe with
     only one end is attempted.

DIAGNOSTICS
     The pipe call will fail if:

     [EMFILE]
         More than NOFILE - 2 (defined in <sys/max.h>)
         descriptors are already open in this process.

     [EFAULT]
         The fd buffer is in an invalid area of the process's
         address space.

     [ENFILE]
         The system file table is full.

     [ENOBUF]
         No buffer space is available for the pipe.





Printed 10/17/86                                                1





PIPE(2)                 COMMAND REFERENCE                 PIPE(2)



RETURN VALUE
     Upon successful completion, a value of 0 is returned.
     Otherwise, a value of -1 is returned and errno is set to
     indicate the error.

CAVEATS
     Should more than 4096 bytes be necessary in any pipe among a
     loop of processes, deadlock will occur.

SEE ALSO
     fork(2), read(2), sh(1sh), socketpair(2), write(2).












































Printed 10/17/86                                                2





































































%%index%%
na:72,87;
sy:159,190;
de:349,1294;
di:1643,489;
rv:2276,236;
ca:2512,162;
se:2674,213;
%%index%%000000000120

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026