1 .\" Copyright (c) 1980 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)pipe.2 6.2 (Berkeley) 8/26/85
7 .TH PIPE 2 "August 26, 1985"
10 pipe \- create an interprocess communication channel
16 int pipe(int \fIfildes\fP[2])
23 creates an I/O mechanism called a pipe.
24 The file descriptors returned can
25 be used in read and write operations.
26 When the pipe is written using the descriptor
28 up to PIPE_MAX bytes of data are buffered
29 before the writing process is suspended.
30 A read using the descriptor
32 will pick up the data.
34 PIPE_MAX equals 7168 under MINIX 3, but note that most systems use 4096.
36 It is assumed that after the
40 (created by subsequent
43 will pass data through the
50 The shell has a syntax
51 to set up a linear array of processes
54 Read calls on an empty
55 pipe (no buffered data) with only one end
56 (all write file descriptors closed)
57 returns an end-of-file.
59 The signal SIGPIPE is generated if a write on a pipe with only one end
62 The function value zero is returned if the
63 pipe was created; \-1 if an error occurred.
65 The \fBpipe\fP call will fail if:
68 Too many descriptors are active.
71 The system file table is full.
74 The pipe file system (usually the root file system) has no free inodes.
77 The \fIfildes\fP buffer is in an invalid area of the process's address
85 Writes may return ENOSPC errors if no pipe data can be buffered, because
86 the pipe file system is full.
88 Should more than PIPE_MAX bytes be necessary in any
89 pipe among a loop of processes, deadlock will occur.