source: trunk/minix/man/man2/pipe.2@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.0 KB
Line 
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.
4.\"
5.\" @(#)pipe.2 6.2 (Berkeley) 8/26/85
6.\"
7.TH PIPE 2 "August 26, 1985"
8.UC 4
9.SH NAME
10pipe \- create an interprocess communication channel
11.SH SYNOPSIS
12.nf
13.ft B
14#include <unistd.h>
15
16int pipe(int \fIfildes\fP[2])
17.fi
18.ft R
19.SH DESCRIPTION
20The
21.B pipe
22system call
23creates an I/O mechanism called a pipe.
24The file descriptors returned can
25be used in read and write operations.
26When the pipe is written using the descriptor
27.IR fildes [1]
28up to PIPE_MAX bytes of data are buffered
29before the writing process is suspended.
30A read using the descriptor
31.IR fildes [0]
32will pick up the data.
33.PP
34PIPE_MAX equals 7168 under MINIX 3, but note that most systems use 4096.
35.PP
36It is assumed that after the
37pipe has been set up,
38two (or more)
39cooperating processes
40(created by subsequent
41.B fork
42calls)
43will pass data through the
44pipe with
45.B read
46and
47.B write
48calls.
49.PP
50The shell has a syntax
51to set up a linear array of processes
52connected by pipes.
53.PP
54Read calls on an empty
55pipe (no buffered data) with only one end
56(all write file descriptors closed)
57returns an end-of-file.
58.PP
59The signal SIGPIPE is generated if a write on a pipe with only one end
60is attempted.
61.SH "RETURN VALUE
62The function value zero is returned if the
63pipe was created; \-1 if an error occurred.
64.SH ERRORS
65The \fBpipe\fP call will fail if:
66.TP 15
67[EMFILE]
68Too many descriptors are active.
69.TP 15
70[ENFILE]
71The system file table is full.
72.TP 15
73[ENOSPC]
74The pipe file system (usually the root file system) has no free inodes.
75.TP 15
76[EFAULT]
77The \fIfildes\fP buffer is in an invalid area of the process's address
78space.
79.SH "SEE ALSO"
80.BR sh (1),
81.BR read (2),
82.BR write (2),
83.BR fork (2).
84.SH NOTES
85Writes may return ENOSPC errors if no pipe data can be buffered, because
86the pipe file system is full.
87.SH BUGS
88Should more than PIPE_MAX bytes be necessary in any
89pipe among a loop of processes, deadlock will occur.
Note: See TracBrowser for help on using the repository browser.