119 lines
2.3 KiB
Groff
119 lines
2.3 KiB
Groff
|
||
|
||
PIPE(2) Minix Programmer's Manual PIPE(2)
|
||
|
||
|
||
NAME
|
||
pipe - create an interprocess communication channel
|
||
|
||
SYNOPSIS
|
||
#include <unistd.h>
|
||
|
||
int pipe(int fildes[2])
|
||
|
||
DESCRIPTION
|
||
The pipe system call creates an I/O mechanism called a pipe. The file
|
||
descriptors returned can be used in read and write operations. When the
|
||
pipe is written using the descriptor fildes[1] up to PIPE_MAX bytes of
|
||
data are buffered before the writing process is suspended. A read using
|
||
the descriptor fildes[0] will pick up the data.
|
||
|
||
PIPE_MAX equals 7168 under Minix, but note that most systems use 4096.
|
||
|
||
It is assumed that after the pipe has been set up, two (or more)
|
||
cooperating processes (created by subsequent fork calls) will pass data
|
||
through the pipe with read and write calls.
|
||
|
||
The shell has a syntax to set up a linear array of processes connected by
|
||
pipes.
|
||
|
||
Read calls on an empty pipe (no buffered data) with only one end (all
|
||
write file descriptors closed) returns an end-of-file.
|
||
|
||
The signal SIGPIPE is generated if a write on a pipe with only one end is
|
||
attempted.
|
||
|
||
RETURN VALUE
|
||
The function value zero is returned if the pipe was created; -1 if an
|
||
error occurred.
|
||
|
||
ERRORS
|
||
The pipe call will fail if:
|
||
|
||
[EMFILE] Too many descriptors are active.
|
||
|
||
[ENFILE] The system file table is full.
|
||
|
||
[ENOSPC] The pipe file system (usually the root file system) has no
|
||
free inodes.
|
||
|
||
[EFAULT] The fildes buffer is in an invalid area of the process's
|
||
address space.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
4BSD August 26, 1985 1
|
||
|
||
|
||
|
||
PIPE(2) Minix Programmer's Manual PIPE(2)
|
||
|
||
|
||
SEE ALSO
|
||
sh(1), read(2), write(2), fork(2).
|
||
|
||
NOTES
|
||
Writes may return ENOSPC errors if no pipe data can be buffered, because
|
||
the pipe file system is full.
|
||
|
||
BUGS
|
||
Should more than PIPE_MAX bytes be necessary in any pipe among a loop of
|
||
processes, deadlock will occur.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
4BSD August 26, 1985 2
|
||
|