1 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" and Copyright (C) 2006, 2014 Michael Kerrisk
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" changed section from 2 to 3, aeb, 950919
28 .TH MKFIFO 3 2021-08-27 "GNU" "Linux Programmer's Manual"
30 mkfifo, mkfifoat \- make a FIFO special file (a named pipe)
33 .B #include <sys/types.h>
34 .B #include <sys/stat.h>
36 .BI "int mkfifo(const char *" pathname ", mode_t " mode );
38 .BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
39 .B #include <sys/stat.h>
41 .BI "int mkfifoat(int " dirfd ", const char *" pathname ", mode_t " mode );
45 Feature Test Macro Requirements for glibc (see
46 .BR feature_test_macros (7)):
52 _POSIX_C_SOURCE >= 200809L
58 makes a FIFO special file with name \fIpathname\fP.
59 \fImode\fP specifies the FIFO's permissions.
61 process's \fBumask\fP in the usual way: the permissions of the created
62 file are \fB(\fP\fImode\fP\fB & \(tiumask)\fP.
64 A FIFO special file is similar to a pipe, except that it is created
66 Instead of being an anonymous communications
67 channel, a FIFO special file is entered into the filesystem by
71 Once you have created a FIFO special file in this way, any process can
72 open it for reading or writing, in the same way as an ordinary file.
73 However, it has to be open at both ends simultaneously before you can
74 proceed to do any input or output operations on it.
75 Opening a FIFO for reading normally blocks until some
76 other process opens the same FIFO for writing, and vice versa.
79 for nonblocking handling of FIFO special files.
83 function operates in exactly the same way as
85 except for the differences described here.
87 If the pathname given in
89 is relative, then it is interpreted relative to the directory
90 referred to by the file descriptor
92 (rather than relative to the current working directory of
93 the calling process, as is done by
95 for a relative pathname).
105 is interpreted relative to the current working
106 directory of the calling process (like
117 for an explanation of the need for
125 On error, \-1 is returned and
127 is set to indicate the error.
131 One of the directories in \fIpathname\fP did not allow search
132 (execute) permission.
141 nor a valid file descriptor.
144 The user's quota of disk blocks or inodes on the filesystem has been
148 \fIpathname\fP already exists.
149 This includes the case where
151 is a symbolic link, dangling or not.
154 Either the total length of \fIpathname\fP is greater than
155 \fBPATH_MAX\fP, or an individual filename component has a length
156 greater than \fBNAME_MAX\fP.
157 In the GNU system, there is no imposed
158 limit on overall filename length, but some filesystems may place
159 limits on the length of a component.
162 A directory component in \fIpathname\fP does not exist or is a
163 dangling symbolic link.
166 The directory or filesystem has no room for the new file.
169 A component used as a directory in \fIpathname\fP is not, in fact, a
175 is a relative pathname and
177 is a file descriptor referring to a file other than a directory.
180 \fIpathname\fP refers to a read-only filesystem.
183 was added to glibc in version 2.4.
184 It is implemented using
186 available on Linux since kernel 2.6.16.
188 For an explanation of the terms used in this section, see
196 Interface Attribute Value
200 T} Thread safety MT-Safe
207 POSIX.1-2001, POSIX.1-2008.