OSDN Git Service

0ef0d18ec39fa2f0d11b00d4ccd4976b233fe7b0
[linuxjm/LDP_man-pages.git] / original / man7 / fifo.7
1 .\" This man page is Copyright (C) 1999 Claus Fischer.
2 .\"
3 .\" %%%LICENSE_START(VERBATIM_ONE_PARA)
4 .\" Permission is granted to distribute possibly modified copies
5 .\" of this page provided the header is included verbatim,
6 .\" and in case of nontrivial modification author and date
7 .\" of the modification is added to the header.
8 .\" %%%LICENSE_END
9 .\"
10 .\" 990620 - page created - aeb@cwi.nl
11 .\"
12 .\" FIXME . Add example programs to this page?
13 .TH FIFO 7 2008-12-03 "Linux" "Linux Programmer's Manual"
14 .SH NAME
15 fifo \- first-in first-out special file, named pipe
16 .SH DESCRIPTION
17 A FIFO special file (a named pipe) is similar to a pipe,
18 except that it is accessed as part of the filesystem.
19 It can be opened by multiple processes for reading or
20 writing.
21 When processes are exchanging data via the FIFO,
22 the kernel passes all data internally without writing it
23 to the filesystem.
24 Thus, the FIFO special file has no
25 contents on the filesystem; the filesystem entry merely
26 serves as a reference point so that processes can access
27 the pipe using a name in the filesystem.
28 .PP
29 The kernel maintains exactly one pipe object for each
30 FIFO special file that is opened by at least one process.
31 The FIFO must be opened on both ends (reading and writing)
32 before data can be passed.
33 Normally, opening the FIFO blocks
34 until the other end is opened also.
35 .PP
36 A process can open a FIFO in nonblocking mode.
37 In this
38 case, opening for read-only will succeed even if no-one has
39 opened on the write side yet, opening for write-only will
40 fail with
41 .B ENXIO
42 (no such device or address) unless the other
43 end has already been opened.
44 .PP
45 Under Linux, opening a FIFO for read and write will succeed
46 both in blocking and nonblocking mode.
47 POSIX leaves this
48 behavior undefined.
49 This can be used to open a FIFO for
50 writing while there are no readers available.
51 A process
52 that uses both ends of the connection in order to communicate
53 with itself should be very careful to avoid deadlocks.
54 .SH NOTES
55 When a process tries to write to a FIFO that is not opened
56 for read on the other side, the process is sent a
57 .B SIGPIPE
58 signal.
59
60 FIFO special files can be created by
61 .BR mkfifo (3),
62 and are indicated by
63 .IR "ls \-l"
64 with the file type \(aqp\(aq.
65 .SH SEE ALSO
66 .BR mkfifo (1),
67 .BR open (2),
68 .BR pipe (2),
69 .BR sigaction (2),
70 .BR signal (2),
71 .BR socketpair (2),
72 .BR mkfifo (3),
73 .BR pipe (7)
74 .SH COLOPHON
75 This page is part of release 3.67 of the Linux
76 .I man-pages
77 project.
78 A description of the project,
79 information about reporting bugs,
80 and the latest version of this page,
81 can be found at
82 \%http://www.kernel.org/doc/man\-pages/.