Open System Services System Calls Reference Manual (G06.25+, H06.03+)
pipe(2) OSS System Calls Reference Manual
NAME
pipe - Creates an interprocess communication channel
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-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.
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.
ERRORS
If any of these conditions occurs, the pipe( ) function sets errno to the corresponding value:
[EFAULT] The filedes parameter is an invalid address.
5−14 Hewlett-Packard Company 527186-003