1PIPE(3P)                   POSIX Programmer's Manual                  PIPE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       pipe - create an interprocess channel
13

SYNOPSIS

15       #include <unistd.h>
16
17       int pipe(int fildes[2]);
18
19

DESCRIPTION

21       The pipe() function shall create a pipe and place two file descriptors,
22       one  each into the arguments fildes[0] and fildes[1], that refer to the
23       open file descriptions for the read and write ends of the  pipe.  Their
24       integer  values  shall  be  the two lowest available at the time of the
25       pipe() call. The O_NONBLOCK and FD_CLOEXEC flags shall be clear on both
26       file  descriptors.  (The fcntl() function can be used to set both these
27       flags.)
28
29       Data can be written to the file descriptor fildes[1] and read from  the
30       file  descriptor  fildes[0].  A  read  on the file descriptor fildes[0]
31       shall access data written to the file descriptor fildes[1] on a  first-
32       in-first-out  basis.   It is unspecified whether fildes[0] is also open
33       for writing and whether fildes[1] is also open for reading.
34
35       A process has the pipe open for reading (correspondingly writing) if it
36       has  a  file  descriptor  open  that  refers to the read end, fildes[0]
37       (write end, fildes[1]).
38
39       Upon successful completion, pipe() shall mark for update the  st_atime,
40       st_ctime, and st_mtime fields of the pipe.
41

RETURN VALUE

43       Upon successful completion, 0 shall be returned; otherwise, -1 shall be
44       returned and errno set to indicate the error.
45

ERRORS

47       The pipe() function shall fail if:
48
49       EMFILE More than {OPEN_MAX} minus two file descriptors are  already  in
50              use by this process.
51
52       ENFILE The  number  of  simultaneously  open  files in the system would
53              exceed a system-imposed limit.
54
55
56       The following sections are informative.
57

EXAMPLES

59       None.
60

APPLICATION USAGE

62       None.
63

RATIONALE

65       The wording carefully avoids using the verb "to open" in order to avoid
66       any implication of use of open(); see also write() .
67

FUTURE DIRECTIONS

69       None.
70

SEE ALSO

72       fcntl(),    read(),   write(),   the   Base   Definitions   volume   of
73       IEEE Std 1003.1-2001, <fcntl.h>, <unistd.h>
74
76       Portions of this text are reprinted and reproduced in  electronic  form
77       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
78       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
79       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
80       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
81       event of any discrepancy between this version and the original IEEE and
82       The Open Group Standard, the original IEEE and The Open Group  Standard
83       is  the  referee document. The original Standard can be obtained online
84       at http://www.opengroup.org/unix/online.html .
85
86
87
88IEEE/The Open Group                  2003                             PIPE(3P)
Impressum