Research V4 development
[unix-history] / man / man2 / pipe.2
CommitLineData
88d0a458
KT
1.th PIPE II 8/5/73
2.sh NAME
3pipe \*- create a pipe
4.sh SYNOPSIS
5(pipe = 42.)
6.br
7.ft B
8sys pipe
9.br
10.ft R
11(read file descriptor in r0)
12.br
13(write file descriptor in r1)
14.s3
15.ft B
16pipe(fildes)
17.br
18int fildes[2];
19.ft R
20.sh DESCRIPTION
21The
22.it pipe
23system call
24creates an I/O mechanism called a pipe.
25The file descriptors returned can
26be used in read and write operations.
27When the pipe is written using the descriptor
28returned in r1 (resp. fildes[1]),
29up to 4096 bytes of data are buffered
30before the writing process is suspended.
31A read using the descriptor returned in r0
32(resp. fildes[0])
33will pick up the data.
34.s3
35It is assumed that after the
36pipe has been set up,
37two (or more)
38cooperating processes
39(created by subsequent
40.it fork
41calls)
42will pass data through the
43pipe with
44.it read
45and
46.it write
47calls.
48.s3
49The shell has a syntax
50to set up a linear array of processes
51connected by pipes.
52.s3
53Read calls on an empty
54pipe (no buffered data) with only one end
55(all write file descriptors closed)
56return an end-of-file.
57Write calls under similar conditions are ignored.
58.sh "SEE ALSO"
59sh(I), read(II), write(II), fork(II)
60.sh DIAGNOSTICS
61The error
62bit (c-bit) is set if
63more than
648 files are already open.
65From C, a \*-1 returned value
66indicates an error.