Research V7 development
[unix-history] / usr / man / man2 / pipe.2
CommitLineData
cbd7c763
KT
1.TH PIPE 2
2.SH NAME
3pipe \- create an interprocess channel
4.SH SYNOPSIS
5.B pipe(fildes)
6.br
7.B int fildes[2];
8.SH DESCRIPTION
9The
10.I pipe
11system call
12creates an I/O mechanism called a pipe.
13The file descriptors returned can
14be used in read and write operations.
15When the pipe is written using the descriptor
16.IR fildes [1]
17up to 4096 bytes of data are buffered
18before the writing process is suspended.
19A read using the descriptor
20.IR fildes [0]
21will pick up the data.
22Writes with a count of 4096 bytes or less are atomic;
23no other process can intersperse data.
24.PP
25It is assumed that after the
26pipe has been set up,
27two (or more)
28cooperating processes
29(created by subsequent
30.I fork
31calls)
32will pass data through the
33pipe with
34.I read
35and
36.I write
37calls.
38.PP
39The Shell has a syntax
40to set up a linear array of processes
41connected by pipes.
42.PP
43Read calls on an empty
44pipe (no buffered data) with only one end
45(all write file descriptors closed)
46returns an end-of-file.
47.SH "SEE ALSO"
48sh(1), read(2), write(2), fork(2)
49.SH DIAGNOSTICS
50The function value zero is returned if the
51pipe was created; \-1 if
52too many files are already open.
53A signal is generated if a write on a pipe with only one end is attempted.
54.SH BUGS
55Should more than 4096 bytes be necessary in any
56pipe among a loop of processes, deadlock will occur.
57.SH ASSEMBLER
58(pipe = 42.)
59.br
60.B sys pipe
61.br
62(read file descriptor in r0)
63.br
64(write file descriptor in r1)