home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 6
/
FreshFish_September1994.bin
/
gnu
/
man
/
cat2
/
pipe.0
< prev
next >
Wrap
Text File
|
1993-12-07
|
2KB
|
67 lines
PIPE(2) UNIX Programmer's Manual PIPE(2)
NNAAMMEE
ppiippee - create descriptor pair for interprocess communication
SSYYNNOOPPSSIISS
##iinncclluuddee <<uunniissttdd..hh>>
_i_n_t
ppiippee(_i_n_t _*_f_i_l_d_e_s)
DDEESSCCRRIIPPTTIIOONN
The ppiippee() function creates a _p_i_p_e, which is an object allowing unidirec
tional data flow, and allocates a pair of file descriptors. The first
descriptor connects to the _r_e_a_d _e_n_d of the pipe, and the second connects
to the _w_r_i_t_e _e_n_d, so that data written to _f_i_l_d_e_s_[_1_] appears on (i.e., can
be read from) _f_i_l_d_e_s_[_0_]. This allows the output of one program to be sent
to another program: the source's standard output is set up to be the
write end of the pipe, and the sink's standard input is set up to be the
read end of the pipe. The pipe itself persists until all its associated
descriptors are closed.
A pipe whose read or write end has been closed is considered _w_i_d_o_w_e_d.
Writing on such a pipe causes the writing process to receive a SIGPIPE
signal. Widowing a pipe is the only way to deliver endoffile to a
reader: after the reader consumes any buffered data, reading a widowed
pipe returns a zero count.
Pipes are really a special case of the socketpair(2) call and, in fact,
are implemented as such in the system.
RREETTUURRNN VVAALLUUEESS
On successful creation of the pipe, zero is returned. Otherwise, a value
of 1 is returned and the variable _e_r_r_n_o set to indicate the error.
EERRRROORRSS
The ppiippee() call will fail if:
[EMFILE] Too many descriptors are active.
[ENFILE] The system file table is full.
[EFAULT] The _f_i_l_d_e_s buffer is in an invalid area of the process's ad
dress space.
SSEEEE AALLSSOO
sh(1), read(2), write(2), fork(2), socketpair(2)
HHIISSTTOORRYY
A ppiippee function call appeared in Version 6 AT&T UNIX.
4th Berkeley Distribution March 10, 1991 1