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 2017-09-15 "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)):
55 _POSIX_C_SOURCE\ >=\ 200809L
64 makes a FIFO special file with name \fIpathname\fP.
65 \fImode\fP specifies the FIFO's permissions.
67 process's \fBumask\fP in the usual way: the permissions of the created
68 file are \fB(\fP\fImode\fP\fB & ~umask)\fP.
70 A FIFO special file is similar to a pipe, except that it is created
72 Instead of being an anonymous communications
73 channel, a FIFO special file is entered into the filesystem by
77 Once you have created a FIFO special file in this way, any process can
78 open it for reading or writing, in the same way as an ordinary file.
79 However, it has to be open at both ends simultaneously before you can
80 proceed to do any input or output operations on it.
81 Opening a FIFO for reading normally blocks until some
82 other process opens the same FIFO for writing, and vice versa.
85 for nonblocking handling of FIFO special files.
89 function operates in exactly the same way as
91 except for the differences described here.
93 If the pathname given in
95 is relative, then it is interpreted relative to the directory
96 referred to by the file descriptor
98 (rather than relative to the current working directory of
99 the calling process, as is done by
101 for a relative pathname).
111 is interpreted relative to the current working
112 directory of the calling process (like
126 In the case of an error, \-1 is returned (in which case, \fIerrno\fP
127 is set appropriately).
131 One of the directories in \fIpathname\fP did not allow search
132 (execute) permission.
135 The user's quota of disk blocks or inodes on the filesystem has been
139 \fIpathname\fP already exists.
140 This includes the case where
142 is a symbolic link, dangling or not.
145 Either the total length of \fIpathname\fP is greater than
146 \fBPATH_MAX\fP, or an individual filename component has a length
147 greater than \fBNAME_MAX\fP.
148 In the GNU system, there is no imposed
149 limit on overall filename length, but some filesystems may place
150 limits on the length of a component.
153 A directory component in \fIpathname\fP does not exist or is a
154 dangling symbolic link.
157 The directory or filesystem has no room for the new file.
160 A component used as a directory in \fIpathname\fP is not, in fact, a
164 \fIpathname\fP refers to a read-only filesystem.
166 The following additional errors can occur for
171 is not a valid file descriptor.
175 is a relative path and
177 is a file descriptor referring to a file other than a directory.
180 was added to glibc in version 2.4.
181 It is implemented using
183 available on Linux since kernel 2.6.16.
185 For an explanation of the terms used in this section, see
191 Interface Attribute Value
195 T} Thread safety MT-Safe
199 POSIX.1-2001, POSIX.1-2008.