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 ledes [2]);
PARAMETERS
filedes Species the address of an array of two integers into which new le descriptors
are placed.
DESCRIPTION
The pipe( ) function creates an interprocess channel called a pipe and returns two le descriptors
in the parameters ledes[0] and ledes[1]. The le descriptor ledes[0] is opened for reading, and
the le descriptor ledes[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 ag is cleared on both
le descriptors. (The fcntl( ) function can be used to set the O_NONBLOCK ag.)
Upon successful completion, the pipe( ) function marks the st_atime, st_ctime, and st_mtime
elds of the pipe for update.
The FD_CLOEXEC ag is cleared on both le descriptors.
Use From the Guardian Environment
The pipe() function is one of a set of functions that have these effects when the rst of them is
called from the Guardian environment:
Two Guardian le system le numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These le 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 rst 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 ledes parameter is an invalid address.
514 Hewlett-Packard Company 527186-003