pipe(2) SDK R4.11 pipe(2)
NAME
pipe - create an interprocess channel
SYNOPSIS
#include <unistd.h>
int pipe (fildes)
int fildes[2];
where:
fildes Address of an array of two file descriptors
DESCRIPTION
pipe creates an I/O mechanism called a pipe and returns two file
descriptors, fildes[0] and fildes[1]. The files associated with
fildes[0] and fildes[1] are streams and are both opened for reading
and writing. The ONDELAY and ONONBLOCK flags are cleared.
A read from fildes[0] accesses the data written to fildes[1] on a
first-in-first-out (FIFO) basis and a read from fildes[1] accesses
the data written to fildes[0] also on a FIFO basis.
The FDCLOEXEC flag will be clear on both file descriptors.
If the process exceeds its limit for open files, the call will fail.
Pipes exist in the channel store, but not in the file name store or
the flat file store. Pipes have no file attributes except time-last-
accessed, time-last-changed, time-last-modified, and size.
ACCESS CONTROL
None.
RETURN VALUE
0 The pipe was successfully created.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EFAULT The fildes[] buffer is an invalid area of the process's
address space.
EMFILE Pipe will fail if NOFILE-1 or more file descriptors are
currently open.
ENFILE The system file table is full.
SEE ALSO
sh(1), fork(2), read(2), readv(2), write(2), writev(2).
Licensed material--property of copyright holder(s)