Named Pipes
Named pipes function much like pipes, but are created as named entities in a file system. This
enables the pipe to be opened by all processes with no requirement that they
be related by forking. A named pipe is created by a call to
mknod
(). Any process with appropriate permission
can then read or write to a named pipe. For more information, see the
mknod
(2) man page.
In the open
()
call, the process opening the pipe blocks until another process
also opens the pipe.
To open a named pipe without blocking, the open
()
call joins the
O_NDELAY
mask (found in
sys/fcntl.h
) with the selected file mode mask
using the Boolean or
operation on the call to
open
(). If no other process is connected to the
pipe when open
()
is called, -1
is returned with
errno
set to EWOULDBLOCK
. For
more information, see the
open
(2) man page.