PIPE(2,L) AIX Technical Reference PIPE(2,L)
-------------------------------------------------------------------------------
pipe
PURPOSE
Creates an interprocess channel.
SYNTAX
int pipe (fildes)
int fildes[2];
DESCRIPTION
The pipe system call creates an interprocess channel called a pipe and returns
two file descriptors, fildes[0] and fildes[1]. The fildes[0] file descriptor
is opened for reading and fildes[1] is opened for writing.
A read on file descriptor fildes [0] accesses the data written to fildes[1] on
a first-in, first-out basis.
When writing, at least 40,960 bytes of data are buffered by the pipe before the
writing process is blocked.
Warning: The actions of the pipe system call are undefined if the fildes
parameter points to a location outside of the process's allocated address
space.
A pipe can be inherited through the fork, rfork and run system calls and held
open as a process moves to a different site using the rexec or migrate system
calls. Through combinations of these operations, it is possible to set up one
or more processes reading data from the read end of the pipe, and one or more
processes writing data to the write end of a pipe. These processes may be on
one site, on different sites but of the same CPU type, or on sites with
differing CPU types. If the reader and writer are on different sites, slightly
better performance results if the pipe call is issued at the site of the
writer. In any case, correct operation should be independent of the
relationships between the sites of the reader, writer, and issuance of the pipe
system call.
RETURN VALUE
Upon successful completion, a value of 0 is returned. If pipe fails, a value
of -1 is returned and errno is set to indicate the error.
ERROR CONDITIONS
The pipe system call fails if one or more the following are true:
Processed November 7, 1990 PIPE(2,L) 1
PIPE(2,L) AIX Technical Reference PIPE(2,L)
EFAULT The fildes parameter points to a location outside of the process's
allocated address space.
EMFILE 199 or more file descriptors are already open.
ENFILE The system file table or inode table is full.
ENOSPC There is no space to create a new pipe in the pipe file system (there
are no more inodes available).
RELATED INFORMATION
In this book: "read, readv, readx," "select," and "write, writex."
The sh command in AIX Operating System Commands Reference.
Processed November 7, 1990 PIPE(2,L) 2