]>
Commit | Line | Data |
---|---|---|
7c4ddad1 | 1 | .\" SPDX-License-Identifier: Linux-man-pages-1-para |
2297bf0e | 2 | .\" |
7c4ddad1 | 3 | .\" This man page is Copyright (C) 1999 Claus Fischer. |
c13182ef | 4 | .\" |
fea681da MK |
5 | .\" 990620 - page created - aeb@cwi.nl |
6 | .\" | |
4c1c5274 | 7 | .TH fifo 7 (date) "Linux man-pages (unreleased)" |
fea681da MK |
8 | .SH NAME |
9 | fifo \- first-in first-out special file, named pipe | |
10 | .SH DESCRIPTION | |
11 | A FIFO special file (a named pipe) is similar to a pipe, | |
9ee4a2b6 | 12 | except that it is accessed as part of the filesystem. |
fea681da | 13 | It can be opened by multiple processes for reading or |
c13182ef MK |
14 | writing. |
15 | When processes are exchanging data via the FIFO, | |
fea681da | 16 | the kernel passes all data internally without writing it |
9ee4a2b6 | 17 | to the filesystem. |
c13182ef | 18 | Thus, the FIFO special file has no |
9ee4a2b6 | 19 | contents on the filesystem; the filesystem entry merely |
fea681da | 20 | serves as a reference point so that processes can access |
9ee4a2b6 | 21 | the pipe using a name in the filesystem. |
c6d039a3 | 22 | .P |
fea681da MK |
23 | The kernel maintains exactly one pipe object for each |
24 | FIFO special file that is opened by at least one process. | |
25 | The FIFO must be opened on both ends (reading and writing) | |
c13182ef MK |
26 | before data can be passed. |
27 | Normally, opening the FIFO blocks | |
fea681da | 28 | until the other end is opened also. |
c6d039a3 | 29 | .P |
ff40dbb3 | 30 | A process can open a FIFO in nonblocking mode. |
c13182ef | 31 | In this |
9b13f770 | 32 | case, opening for read-only succeeds even if no one has |
26cd31fd MK |
33 | opened on the write side yet and opening for write-only |
34 | fails with | |
097585ed MK |
35 | .B ENXIO |
36 | (no such device or address) unless the other | |
fea681da | 37 | end has already been opened. |
c6d039a3 | 38 | .P |
fea681da | 39 | Under Linux, opening a FIFO for read and write will succeed |
ff40dbb3 | 40 | both in blocking and nonblocking mode. |
c13182ef | 41 | POSIX leaves this |
d9bfdb9c | 42 | behavior undefined. |
c13182ef MK |
43 | This can be used to open a FIFO for |
44 | writing while there are no readers available. | |
45 | A process | |
fea681da MK |
46 | that uses both ends of the connection in order to communicate |
47 | with itself should be very careful to avoid deadlocks. | |
48 | .SH NOTES | |
bd054369 | 49 | For details of the semantics of I/O on FIFOs, see |
84661892 | 50 | .BR pipe (7). |
c6d039a3 | 51 | .P |
fea681da | 52 | When a process tries to write to a FIFO that is not opened |
8bd58774 MK |
53 | for read on the other side, the process is sent a |
54 | .B SIGPIPE | |
fea681da | 55 | signal. |
c6d039a3 | 56 | .P |
fea681da MK |
57 | FIFO special files can be created by |
58 | .BR mkfifo (3), | |
d91ca9d3 | 59 | and are indicated by |
1ae6b2c7 | 60 | .I ls\~\-l |
b957f81f | 61 | with the file type \[aq]p\[aq]. |
47297adb | 62 | .SH SEE ALSO |
fea681da MK |
63 | .BR mkfifo (1), |
64 | .BR open (2), | |
65 | .BR pipe (2), | |
66 | .BR sigaction (2), | |
67 | .BR signal (2), | |
68 | .BR socketpair (2), | |
be37f2c5 MK |
69 | .BR mkfifo (3), |
70 | .BR pipe (7) |