pipe(2) CLIX pipe(2)
NAME
pipe - Creates an interprocess channel
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
int pipe(
int file_des[2] );
PARAMETERS
file_des Specifies 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, file_des[0] and file_des[1]. The
filedes[0] file descriptor is opened for reading and file_des[1] is opened
for writing. Their integer values will be the two lowest available at the
time of the pipe() call.
A read on file descriptor file_des[0] accesses the data written to
file_des[1] on a first-in, first-out (FIFO) basis.
When writing, at least pipe_buf bytes of data are buffered by the pipe
before the writing process is blocked.
EXAMPLES
To create a pipe:
int pipe_fds[2];
if (pipe(pipe_fds) == -1)
perror("pipe failed\n");
RETURN VALUES
Upon successful completion, a value of 0 is returned. If pipe() fails, a
value of -1 is returned and the global variable errno is set to identify
the error.
ERRORS
The pipe() function fails if one or more the following are true:
2/94 - Intergraph Corporation 1
pipe(2) CLIX pipe(2)
[EMFILE] NOFILE (see master.d) file descriptors are already open.
[ENFILE] The system file table is full.
RELATED INFORMATION
Commands: sh(1)
Functions: read(2), fcntl(2), select(2), write(2)
2 Intergraph Corporation - 2/94