1 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" and Copyright (C) 2006, 2014 Michael Kerrisk
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" changed section from 2 to 3, aeb, 950919
8 .TH MKFIFO 3 2021-08-27 "Linux man-pages (unreleased)"
10 mkfifo, mkfifoat \- make a FIFO special file (a named pipe)
13 .RI ( libc ", " \-lc )
16 .B #include <sys/types.h>
17 .B #include <sys/stat.h>
19 .BI "int mkfifo(const char *" pathname ", mode_t " mode );
21 .BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
22 .B #include <sys/stat.h>
24 .BI "int mkfifoat(int " dirfd ", const char *" pathname ", mode_t " mode );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
35 _POSIX_C_SOURCE >= 200809L
41 makes a FIFO special file with name \fIpathname\fP.
42 \fImode\fP specifies the FIFO's permissions.
44 process's \fBumask\fP in the usual way: the permissions of the created
45 file are \fB(\fP\fImode\fP\fB & \(tiumask)\fP.
47 A FIFO special file is similar to a pipe, except that it is created
49 Instead of being an anonymous communications
50 channel, a FIFO special file is entered into the filesystem by
54 Once you have created a FIFO special file in this way, any process can
55 open it for reading or writing, in the same way as an ordinary file.
56 However, it has to be open at both ends simultaneously before you can
57 proceed to do any input or output operations on it.
58 Opening a FIFO for reading normally blocks until some
59 other process opens the same FIFO for writing, and vice versa.
62 for nonblocking handling of FIFO special files.
66 function operates in exactly the same way as
68 except for the differences described here.
70 If the pathname given in
72 is relative, then it is interpreted relative to the directory
73 referred to by the file descriptor
75 (rather than relative to the current working directory of
76 the calling process, as is done by
78 for a relative pathname).
88 is interpreted relative to the current working
89 directory of the calling process (like
100 for an explanation of the need for
108 On error, \-1 is returned and
110 is set to indicate the error.
114 One of the directories in \fIpathname\fP did not allow search
115 (execute) permission.
124 nor a valid file descriptor.
127 The user's quota of disk blocks or inodes on the filesystem has been
131 \fIpathname\fP already exists.
132 This includes the case where
134 is a symbolic link, dangling or not.
137 Either the total length of \fIpathname\fP is greater than
138 \fBPATH_MAX\fP, or an individual filename component has a length
139 greater than \fBNAME_MAX\fP.
140 In the GNU system, there is no imposed
141 limit on overall filename length, but some filesystems may place
142 limits on the length of a component.
145 A directory component in \fIpathname\fP does not exist or is a
146 dangling symbolic link.
149 The directory or filesystem has no room for the new file.
152 A component used as a directory in \fIpathname\fP is not, in fact, a
158 is a relative pathname and
160 is a file descriptor referring to a file other than a directory.
163 \fIpathname\fP refers to a read-only filesystem.
166 was added to glibc in version 2.4.
167 It is implemented using
169 available on Linux since kernel 2.6.16.
171 For an explanation of the terms used in this section, see
179 Interface Attribute Value
183 T} Thread safety MT-Safe
190 POSIX.1-2001, POSIX.1-2008.