string_copying.7: wfix
[man-pages.git] / man / man7 / fifo.7
blob92ac5fd89c9012e9442f4a06a65daeebde0499fe
1 .\" SPDX-License-Identifier: Linux-man-pages-1-para
2 .\"
3 .\" This man page is Copyright (C) 1999 Claus Fischer.
4 .\"
5 .\" 990620 - page created - aeb@cwi.nl
6 .\"
7 .TH fifo 7 (date) "Linux man-pages (unreleased)"
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,
12 except that it is accessed as part of the filesystem.
13 It can be opened by multiple processes for reading or
14 writing.
15 When processes are exchanging data via the FIFO,
16 the kernel passes all data internally without writing it
17 to the filesystem.
18 Thus, the FIFO special file has no
19 contents on the filesystem; the filesystem entry merely
20 serves as a reference point so that processes can access
21 the pipe using a name in the filesystem.
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)
26 before data can be passed.
27 Normally, opening the FIFO blocks
28 until the other end is opened also.
30 A process can open a FIFO in nonblocking mode.
31 In this
32 case, opening for read-only succeeds even if no one has
33 opened on the write side yet and opening for write-only
34 fails with
35 .B ENXIO
36 (no such device or address) unless the other
37 end has already been opened.
39 Under Linux, opening a FIFO for read and write will succeed
40 both in blocking and nonblocking mode.
41 POSIX leaves this
42 behavior undefined.
43 This can be used to open a FIFO for
44 writing while there are no readers available.
45 A process
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
49 For details of the semantics of I/O on FIFOs, see
50 .BR pipe (7).
52 When a process tries to write to a FIFO that is not opened
53 for read on the other side, the process is sent a
54 .B SIGPIPE
55 signal.
57 FIFO special files can be created by
58 .BR mkfifo (3),
59 and are indicated by
60 .I ls\~\-l
61 with the file type \[aq]p\[aq].
62 .SH SEE ALSO
63 .BR mkfifo (1),
64 .BR open (2),
65 .BR pipe (2),
66 .BR sigaction (2),
67 .BR signal (2),
68 .BR socketpair (2),
69 .BR mkfifo (3),
70 .BR pipe (7)