1PIPE(2) System Calls Manual PIPE(2)
2
3
4
6 pipe - create an interprocess channel
7
9 pipe(fildes)
10 int fildes[2];
11
13 The pipe system call creates an I/O mechanism called a pipe. The file
14 descriptors returned can be used in read and write operations. When
15 the pipe is written using the descriptor fildes[1] up to 4096 bytes of
16 data are buffered before the writing process is suspended. A read
17 using the descriptor fildes[0] will pick up the data. Writes with a
18 count of 4096 bytes or less are atomic; no other process can inter‐
19 sperse data.
20
21 It is assumed that after the pipe has been set up, two (or more) coop‐
22 erating processes (created by subsequent fork calls) will pass data
23 through the pipe with read and write calls.
24
25 The Shell has a syntax to set up a linear array of processes connected
26 by pipes.
27
28 Read calls on an empty pipe (no buffered data) with only one end (all
29 write file descriptors closed) returns an end-of-file.
30
32 sh(1), read(2), write(2), fork(2)
33
35 The function value zero is returned if the pipe was created; -1 if too
36 many files are already open. A signal is generated if a write on a
37 pipe with only one end is attempted.
38
40 Should more than 4096 bytes be necessary in any pipe among a loop of
41 processes, deadlock will occur.
42
44 (pipe = 42.)
45 sys pipe
46 (read file descriptor in r0)
47 (write file descriptor in r1)
48
49
50
51 PIPE(2)