Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 8
Create a pipe
#include <unistd.h>
int pipe( int fildes[2] );
- fildes
- An array where the function can store the file descriptors for the ends of
the pipe.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The pipe() function creates a pipe (an unnamed FIFO) and places a
file descriptor for the read end of the pipe in fildes[0],
and a file descriptor for the write end of the pipe in fildes[1].
Their integer values are the two lowest available at the time of the pipe() function call.
The O_NONBLOCK flag is cleared for both file descriptors.
(You can use
fcntl()
to set the O_NONBLOCK flag.)
You can write data to file descriptor fildes[1] and
read it from file descriptor fildes[0].
If you read from file descriptor fildes[0], it returns the data
written to
fildes[1] on a first-in-first-out (FIFO) basis.
The pipe buffer is allocated by the
pipe
resource manager.
You typically use this function to connect standard utilities acting as
filters,
passing the write end of the pipe to the data-producing process as
its STDOUT_FILENO, and the read end of the pipe to the
data-consuming process as its STDIN_FILENO
(either via the traditional
fork(),
dup2(),
or exec*,
or the more efficient spawn* calls).
If successful, pipe() marks the st_ftime,
st_ctime, st_atime and st_mtime fields
of the pipe for updating.
- 0
- Success.
- -1
- An error occurred (errno is set).
- EMFILE
- The calling process doesn't have at least 2 unused file descriptors available.
- ENFILE
- The number of simultaneously open files in the system would exceed the configured limit.
- ENOSPC
- There's insufficient space available to allocate the pipe buffer.
- ENOSYS
- There's no pipe manager running.
- EROFS
- The pipe pathname space is a read-only filesystem.
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno,
fcntl(),
nbaconnect(),
open(),
popen(),
read(),
write()
pipe
in the Utilities Reference
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 203
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pipe.html on line 203