PIPE(2) DOMAIN/IX SYS5 PIPE(2)
NAME
pipe - create an interprocess communication channel
USAGE
pipe(fildes)
int fildes[2];
DESCRIPTION
The pipe system call creates an I/O mechanism called a pipe.
The file descriptors returned can be used in read(2) and
write(2) operations. When the pipe is written using the
descriptor fildes[1], up to 5120 bytes of data are buffered
before the writing process is suspended. A read(2) using
the descriptor fildes[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 and write
calls.
The shell has a syntax that allows users to set up a linear
array of processes connected by pipes.
Read calls on an empty pipe (one with no buffered data and
no writers) return an end-of-file.
Attempts to write to a pipe that has no readers will gen-
erate a SIGPIPE signal.
NOTES
Deadlock will occur if more than 5120 bytes are necessary in
any pipe among a loop of processes.
RETURN VALUE
A successful call returns zero. A failed call returns -1
and sets errno as indicated below.
ERRORS
The pipe call will fail if:
[EMFILE] Too many descriptors are active.
[EFAULT] The fildes buffer is in an invalid area of the
process's address space.
RELATED INFORMATION
sh(1), read(2), write(2), fork(2)
Printed 12/4/86 PIPE-1