2 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
3 .\" and Copyright (C) 2006, 2014 Michael Kerrisk
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\" changed section from 2 to 3, aeb, 950919
9 .TH mkfifo 3 (date) "Linux man-pages (unreleased)"
11 mkfifo, mkfifoat \- make a FIFO special file (a named pipe)
14 .RI ( libc ", " \-lc )
17 .B #include <sys/types.h>
18 .B #include <sys/stat.h>
20 .BI "int mkfifo(const char *" pathname ", mode_t " mode );
22 .BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
23 .B #include <sys/stat.h>
25 .BI "int mkfifoat(int " dirfd ", const char *" pathname ", mode_t " mode );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
36 _POSIX_C_SOURCE >= 200809L
42 makes a FIFO special file with name \fIpathname\fP.
43 \fImode\fP specifies the FIFO's permissions.
45 process's \fBumask\fP in the usual way: the permissions of the created
46 file are \fB(\fP\fImode\fP\fB & \[ti]umask)\fP.
48 A FIFO special file is similar to a pipe, except that it is created
50 Instead of being an anonymous communications
51 channel, a FIFO special file is entered into the filesystem by
55 Once you have created a FIFO special file in this way, any process can
56 open it for reading or writing, in the same way as an ordinary file.
57 However, it has to be open at both ends simultaneously before you can
58 proceed to do any input or output operations on it.
59 Opening a FIFO for reading normally blocks until some
60 other process opens the same FIFO for writing, and vice versa.
63 for nonblocking handling of FIFO special files.
67 function operates in exactly the same way as
69 except for the differences described here.
71 If the pathname given in
73 is relative, then it is interpreted relative to the directory
74 referred to by the file descriptor
76 (rather than relative to the current working directory of
77 the calling process, as is done by
79 for a relative pathname).
89 is interpreted relative to the current working
90 directory of the calling process (like
101 for an explanation of the need for
109 On error, \-1 is returned and
111 is set to indicate the error.
115 One of the directories in \fIpathname\fP did not allow search
116 (execute) permission.
125 nor a valid file descriptor.
128 The user's quota of disk blocks or inodes on the filesystem has been
132 \fIpathname\fP already exists.
133 This includes the case where
135 is a symbolic link, dangling or not.
138 Either the total length of \fIpathname\fP is greater than
139 \fBPATH_MAX\fP, or an individual filename component has a length
140 greater than \fBNAME_MAX\fP.
141 In the GNU system, there is no imposed
142 limit on overall filename length, but some filesystems may place
143 limits on the length of a component.
146 A directory component in \fIpathname\fP does not exist or is a
147 dangling symbolic link.
150 The directory or filesystem has no room for the new file.
153 A component used as a directory in \fIpathname\fP is not, in fact, a
159 is a relative pathname and
161 is a file descriptor referring to a file other than a directory.
164 \fIpathname\fP refers to a read-only filesystem.
166 For an explanation of the terms used in this section, see
172 Interface Attribute Value
178 T} Thread safety MT-Safe
181 It is implemented using