pipe

Creates an inter-process channel.

Local Servers:blocking
Remote Servers:N/A
Classification:UNIX (nonstandard)
NetWare Server:3.12, 3.2, 4.x, 5.x, 6.x
Platform:NLM
Service:Operating System I/O

Syntax

  #include <unistd.h>   
   
  int pipe (  
     int   fildes[2]);
  

Parameters

fildes
(OUT) Specifies the file descriptions for the ends of the newly created pipe.

Return Values

pipe returns zero upon successful completion. Otherwise, -1 is returned and errno indicates the occurring error.

If an error occurs, errno can be set to:

EMFILE

More than (OPEN_MAX)-2 file descriptors are already in use.

ENFILE

The number of simultaneously open files in the system would exceed a system-imposed limit.

Remarks

pipe creates a pipe and places two file descriptions (into fildes[0] and fildes[1]) for the read and write ends of the pipe. Their integer values shall be the two lowest that available at the time pipe is called. O_NONBLOCK and FD_CLOEXEC, which can be set by calling fcntl, should be clear on both file descriptors.

Data can be written to fildes[1] and read from fildes[0]. A read on fildes[0] accesses the data written to fildes[1] on a first-in-first-out 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 updates the st_atime, st_ctime, and st_mtime fields of the new pipe.

See Also

fcntl, ioctl, poll, open, read, write