Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (n - p) pipe(2)
NAME
pipe - Creates an interprocess communication channel
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int pipe(
int filedes [2]);
PARAMETERS
filedes Specifies the address of an array of two integers into which new file descriptors
are placed.
DESCRIPTION
The pipe( ) function creates an interprocess channel called a pipe and returns two file descriptors
in the parameters filedes[0] and filedes[1]. The file descriptor filedes[0] is opened for reading, and
the file descriptor filedes[1] is opened for writing. Their integer values are the two lowest avail-
able at the time of the call to the pipe( ) function. The O_NONBLOCK flag is cleared on both
file descriptors. (The fcntl( ) function can be used to set the O_NONBLOCK flag.)
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 is cleared on both file descriptors.
Use From the Guardian Environment
The pipe( ) function is one of a set of functions that have these effects when the first of them is
called from the Guardian environment:
Two Guardian file system file numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These file numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
The current working directory is assigned from the VOLUME attribute of the Guardian
environment =_DEFAULTS DEFINE.
The use of static memory by the process increases slightly.
These effects occur only when the first of the set of functions is called. The effects are not cumu-
lative.
NOTES
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. If the pipe() function fails, the value
-1 is returned, and errno is set to indicate the error.
527186-023 Hewlett-Packard Company 527