128 lines
3.5 KiB
HTML
128 lines
3.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of FIFO</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>FIFO</H1>
|
|
Section: Linux Programmer's Manual (7)<BR>Updated: 2017-11-26<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
fifo - first-in first-out special file, named pipe
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
A FIFO special file (a named pipe) is similar to a pipe,
|
|
except that it is accessed as part of the filesystem.
|
|
It can be opened by multiple processes for reading or
|
|
writing.
|
|
When processes are exchanging data via the FIFO,
|
|
the kernel passes all data internally without writing it
|
|
to the filesystem.
|
|
Thus, the FIFO special file has no
|
|
contents on the filesystem; the filesystem entry merely
|
|
serves as a reference point so that processes can access
|
|
the pipe using a name in the filesystem.
|
|
<P>
|
|
|
|
The kernel maintains exactly one pipe object for each
|
|
FIFO special file that is opened by at least one process.
|
|
The FIFO must be opened on both ends (reading and writing)
|
|
before data can be passed.
|
|
Normally, opening the FIFO blocks
|
|
until the other end is opened also.
|
|
<P>
|
|
|
|
A process can open a FIFO in nonblocking mode.
|
|
In this
|
|
case, opening for read-only succeeds even if no one has
|
|
opened on the write side yet and opening for write-only
|
|
fails with
|
|
<B>ENXIO</B>
|
|
|
|
(no such device or address) unless the other
|
|
end has already been opened.
|
|
<P>
|
|
|
|
Under Linux, opening a FIFO for read and write will succeed
|
|
both in blocking and nonblocking mode.
|
|
POSIX leaves this
|
|
behavior undefined.
|
|
This can be used to open a FIFO for
|
|
writing while there are no readers available.
|
|
A process
|
|
that uses both ends of the connection in order to communicate
|
|
with itself should be very careful to avoid deadlocks.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
For details of the semantics of I/O on FIFOs, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pipe">pipe</A></B>(7).
|
|
|
|
<P>
|
|
|
|
When a process tries to write to a FIFO that is not opened
|
|
for read on the other side, the process is sent a
|
|
<B>SIGPIPE</B>
|
|
|
|
signal.
|
|
<P>
|
|
|
|
FIFO special files can be created by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mkfifo">mkfifo</A></B>(3),
|
|
|
|
and are indicated by
|
|
<I>ls -l</I>
|
|
|
|
with the file type 'p'.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+mkfifo">mkfifo</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pipe">pipe</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+socketpair">socketpair</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mkfifo">mkfifo</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pipe">pipe</A></B>(7)
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">NOTES</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">SEE ALSO</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:08 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|