pipe(2)pipe(2)NAMEpipe - Create an interprocess channel
int filedes );
Interfaces documented on this reference page conform to industry stan‐
dards as follows:
pipe(): XSH4.0, XSH4.2, XSH5.0
Refer to the standards(5) reference page for more information about
industry standards and associated tags.
Specifies the address of an array of two integers into which the new
file descriptors are placed.
The pipe() function creates a unidirectional interprocess channel
called a pipe, and returns two file descriptors, filedes and
filedes. The file descriptor specified by the filedes parameter
is opened for reading and the file descriptor specified by the
filedes parameter is opened for writing. Their integer values will
be the two lowest available at the time of the call to the pipe() func‐
A process has the pipe open for reading if it has a file descriptor
open that refers to the read end, filedes. A process has the pipe
open for writing if it has a file descriptor open that refers to the
write end, filedes. A read operation on file descriptor filedes
accesses the data written to filedes on a first-in, first-out (FIFO)
In the System V compatiblity environment, filedes and filedes are
STREAMS based and are bidirectional. Data written on filedes
appears on filedes and vice versa. Data is read in a first-in,
first-out (FIFO) basis.
The O_NONBLOCK and the FD_CLOEXC flags are set clear on both file
descriptors. (The fcntl() function can be used to set the O_NONBLOCK
Upon successful completion, the pipe() function marks the st_atime,
st_ctime and st_mtime fields of the pipe for update.
[Tru64 UNIX] When a read() or write() system call on a pipe is inter‐
rupted by a signal and no bytes have been transferred through the pipe,
the read() or write() system call returns a -1 and errno is set to
[EINTR]. This behavior differs from behavior in early releases of the
operating system, when both system calls either restarted the transfer
or caused errno to be set to [EINTR], depending on the setting of the
SA_RESTART flag for the interrupting signal.
[Tru64 UNIX] As a result of this change, applications must now either
handle the [EINTR] return or block any expected signals for the dura‐
tion of the read or write operation.
[Tru64 UNIX] When compiled in the X/Open UNIX environment, calls to
the pipe() function are internally renamed by prepending _E to the
function name. When you are debugging a module that includes the pipe()
function and for which _XOPEN_SOURCE_EXTENDED has been defined, use
_Epipe to refer to the pipe() call. See standards(5) for further
Upon successful completion, a value of 0 (zero) is returned. If the
pipe() function fails, a value of -1 is returned and errno is set to
indicate the error.
If the pipe() function fails, errno may be set to one of the following
values: [Tru64 UNIX] The filedes parameter is an invalid address.
[Tru64 UNIX] A read() or a write() call on a pipe is interrupted by a
signal and no bytes have been transferred through the pipe. More than
OPEN_MAX-2 file descriptors are already opened by this process.
[Tru64 UNIX] More than getdtablesize(2) file descriptors are
already opened by this process. The system file table is full,
or the device containing pipes has no free i-nodes. [Tru64
UNIX] The system was unable to allocate kernel memory for more
Functions: fcntl(2), getmsg(2), getdtablesize(2), poll(2), putmsg(2),
read(2), select(2), write(2)