pipe(2) — System Calls
OSF — Environment_Note_Added
NAME
pipe − Creates an interprocess channel
SYNOPSIS
int pipe (
int filedes[2] );
PARAMETERS
filedesSpecifies the address of an array of two integers into which the new file descriptors are placed.
DESCRIPTION
The pipe() function creates a unidirectional interprocess channel called a pipe, and returns two file descriptors, filedes[0] and filedes[1]. The file descriptor specified by the filedes[0] parameter is opened for reading and the file descriptor specified by the filedes[1] parameter is opened for writing. Their integer values will be the two lowest available at the time of the call to the pipe() function. The O_NONBLOCK flag will be clear on both file descriptors. (The fcntl() function can be used to set the O_NONBLOCK flag.)
A process has the pipe open for reading if it has a file descriptor open that refers to the read end, filedes[0]. A process has the pipe open for writing if it has a file descriptor open that refers to the write end, filedes[1]. A read on file descriptor filedes[0] accesses the data written to filedes[1] on a first-in, first-out (FIFO) basis.
Upon successful completion, the pipe() function marks the st_atime, st_ctime and st_mtime fields of the pipe for update.
The FD_CLOEXEC flag will be clear on both file descriptors.
NOTES
AES Support Level:
Full use
RETURN VALUES
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.
ERRORS
If the pipe() function fails, errno may be set to one of the following values:
[EFAULT]The filedes parameter is an invalid address.
[EMFILE]More than OPEN_MAX-2 file descriptors are already open by this process.
[ENFILE]The system file table is full, or the device containing pipes has no free i-nodes.
ENVIRONMENT NOTES
This section describes system features that are not generic to OSF/1 but that are provided in this OSF/1 implementation.
Digital Extensions
Errors
If the pipe() function fails, errno may be set to one of the following values:
[EMFILE]More than getdtablesize()−2 file descriptors are already opened by this process.
[ENOMEM]The system was unable to allocate kernel memory for more file descriptors.
RELATED INFORMATION
Functions: getdtablesize(2)
RELATED INFORMATION
Functions: read(2), fcntl(2), select(2), write(2)
Commands: sh(1)