HP 3000 Manuals

pipe [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation


MPE/iX Developer's Kit Reference Manual Volume I

pipe 

Create an inter-process channel.

Syntax 

     int pipe (int fildes[2])

Parameters 

fildes     An open file descriptor.

Return Values 

0          successful completion

-1         error, errno is set to indicate the error

Description 

The pipe() function creates a pipe and places two file descriptors, one
each into the arguments fildes[0] and fildes[1].  These arguments refer
to the open file descriptions for the read and write ends of the pipe.
Their integer values are the two lowest available at the time of the
pipe() function call.  The O_NONBLOCK and FD_CLOEXEC flags are clear on
both file descriptors.  The fcntl() function can be used to set these
flags.

Data is 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 file descriptor fildes[1] on a first-in-first-out basis.

A process has the pipe open for reading if the read end file descriptor,
fildes[0], is open.  A process has the pipe open for writing if the write
end file descriptor, fildes[1] is open.

Upon successful completion, the pipe() function marks for update the
st_atime, st_ctime, and st_mtime fields of the pipe.

Implementation Considerations 

None.

Errors 

If an error occurs, errno is set to one of the following values:

EMFILE            CAUSE           More than {OPEN_MAX}-2 file descriptors are already
                                  in use by this process.
                  ACTION          Check process limit in <limits.h>.  Close a file.

ENFILE            CAUSE           The number of simultaneously open files in the system
                                  would exceed a system-imposed limit.
                  ACTION          Close a file.

See Also 

fcntl(), open(), read(), write(), POSIX.1



MPE/iX 5.0 Documentation