V4/man/man2/pipe.2

Compare this file to the similar file:
Show the results in this format:

.th PIPE II 8/5/73
.sh NAME
pipe \*- create a pipe
.sh SYNOPSIS
(pipe = 42.)
.br
.ft B
sys pipe
.br
.ft R
(read file descriptor in r0)
.br
(write file descriptor in r1)
.s3
.ft B
pipe(fildes)
.br
int fildes[2];
.ft R
.sh DESCRIPTION
The
.it pipe
system call
creates an I/O mechanism called a pipe.
The file descriptors returned can
be used in read and write operations.
When the pipe is written using the descriptor
returned in r1 (resp. fildes[1]),
up to 4096 bytes of data are buffered
before the writing process is suspended.
A read using the descriptor returned in r0
(resp. fildes[0])
will pick up the data.
.s3
It is assumed that after the
pipe has been set up,
two (or more)
cooperating processes
(created by subsequent
.it fork
calls)
will pass data through the
pipe with
.it read
and
.it write
calls.
.s3
The shell has a syntax
to set up a linear array of processes
connected by pipes.
.s3
Read calls on an empty
pipe (no buffered data) with only one end
(all write file descriptors closed)
return an end-of-file.
Write calls under similar conditions are ignored.
.sh "SEE ALSO"
sh(I), read(II), write(II), fork(II)
.sh DIAGNOSTICS
The error
bit (c-bit) is set if
more than
8 files are already open.
From C, a \*-1 returned value
indicates an error.