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

NAME

6       pipe - create an interprocess channel
7

SYNOPSIS

9       #include <unistd.h>
10
11       int pipe(int fildes[2]);
12
13

DESCRIPTION

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

RETURN VALUE

37       Upon successful completion, 0 shall be returned; otherwise, -1 shall be
38       returned and errno set to indicate the error.
39

ERRORS

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

EXAMPLES

53       None.
54

APPLICATION USAGE

56       None.
57

RATIONALE

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

FUTURE DIRECTIONS

63       None.
64

SEE ALSO

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