PIPE(2-POSIX) RISC/os Reference Manual PIPE(2-POSIX)
NAME
pipe - create an interprocess channel
SYNOPSIS
int pipe (fildes)
int fildes[2];
DESCRIPTION
pipe creates an I/O mechanism called a pipe and returns two
file descriptors, fildes[0] and fildes[1], that refer to the
read and write ends of the pipe. Their integer values are
the two lowest available at the time of the function call.
The ONONBLOCK and FDCLOEXEC flags are cleared for both
file descriptors.
Data can be written to file descriptor fildes[1] and read
from file descriptor fildes[0]. A read on file descriptor
fildes[0] accesses the data written to fildes[1] on a
first-in-first-out (FIFO) basis.
A process has the pipe open for reading if it has a file
descriptor open that refers to the read end, fildes[0]. A
process has the pipe open for writing if it has a file
descriptor open that refers to the write end, fildes[1].
Upon successful completion, pipe marks for update the
st_atime, st_ctime, and st_mtime fields of the pipe.
ERRORS
pipe will fail if:
[EMFILE] More than {OPEN_MAX} - 2 file descrip-
tors are already in use by this process.
[ENFILE] The system file table is full.
SEE ALSO
read(2), write(2).
sh(1) in the User's Reference Manual.
DIAGNOSTICS
Upon successful completion, a value of 0 is returned. Oth-
erwise, a value of -1 is returned and errno is set to indi-
cate the error.
Printed 1/15/91 Page 1