]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com> |
464bbf04 | 2 | .\" and Copyright (C) 2006, 2014 Michael Kerrisk |
fea681da | 3 | .\" |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
8 | .\" | |
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. | |
c13182ef | 13 | .\" |
fea681da MK |
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 | |
20 | .\" professionally. | |
c13182ef | 21 | .\" |
fea681da MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
fea681da MK |
25 | .\" |
26 | .\" changed section from 2 to 3, aeb, 950919 | |
27 | .\" | |
4b8c67d9 | 28 | .TH MKFIFO 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 29 | .SH NAME |
464bbf04 | 30 | mkfifo, mkfifoat \- make a FIFO special file (a named pipe) |
fea681da MK |
31 | .SH SYNOPSIS |
32 | .nf | |
33 | .B #include <sys/types.h> | |
34 | .B #include <sys/stat.h> | |
68e4db0a | 35 | .PP |
fea681da | 36 | .BI "int mkfifo(const char *" pathname ", mode_t " mode ); |
f90f031e | 37 | |
464bbf04 MK |
38 | .BR "#include <fcntl.h> " "/* Definition of AT_* constants */" |
39 | .B #include <sys/stat.h> | |
68e4db0a | 40 | .PP |
464bbf04 | 41 | .BI "int mkfifoat(int " dirfd ", const char *" pathname ", mode_t " mode ); |
fea681da | 42 | .fi |
68e4db0a | 43 | .PP |
464bbf04 MK |
44 | .in -4n |
45 | Feature Test Macro Requirements for glibc (see | |
46 | .BR feature_test_macros (7)): | |
47 | .in | |
68e4db0a | 48 | .PP |
464bbf04 MK |
49 | .BR mkfifoat (): |
50 | .PD 0 | |
51 | .ad l | |
52 | .RS 4 | |
53 | .TP 4 | |
54 | Since glibc 2.10: | |
b0da7b8b | 55 | _POSIX_C_SOURCE\ >=\ 200809L |
464bbf04 MK |
56 | .TP |
57 | Before glibc 2.10: | |
58 | _ATFILE_SOURCE | |
59 | .RE | |
60 | .ad | |
61 | .PD | |
fea681da | 62 | .SH DESCRIPTION |
60a90ecd MK |
63 | .BR mkfifo () |
64 | makes a FIFO special file with name \fIpathname\fP. | |
c13182ef MK |
65 | \fImode\fP specifies the FIFO's permissions. |
66 | It is modified by the | |
fea681da MK |
67 | process's \fBumask\fP in the usual way: the permissions of the created |
68 | file are \fB(\fP\fImode\fP\fB & ~umask)\fP. | |
69 | .PP | |
70 | A FIFO special file is similar to a pipe, except that it is created | |
c13182ef MK |
71 | in a different way. |
72 | Instead of being an anonymous communications | |
9ee4a2b6 | 73 | channel, a FIFO special file is entered into the filesystem by |
60a90ecd MK |
74 | calling |
75 | .BR mkfifo (). | |
fea681da MK |
76 | .PP |
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 | |
c13182ef MK |
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. | |
83 | See | |
af5b2ef2 | 84 | .BR fifo (7) |
ff40dbb3 | 85 | for nonblocking handling of FIFO special files. |
464bbf04 MK |
86 | .SS mkfifoat() |
87 | The | |
88 | .BR mkfifoat () | |
89 | function operates in exactly the same way as | |
cadd38ba | 90 | .BR mkfifo (), |
464bbf04 | 91 | except for the differences described here. |
847e0d88 | 92 | .PP |
464bbf04 MK |
93 | If the pathname given in |
94 | .I pathname | |
95 | is relative, then it is interpreted relative to the directory | |
96 | referred to by the file descriptor | |
97 | .I dirfd | |
98 | (rather than relative to the current working directory of | |
99 | the calling process, as is done by | |
cadd38ba | 100 | .BR mkfifo () |
464bbf04 | 101 | for a relative pathname). |
847e0d88 | 102 | .PP |
464bbf04 MK |
103 | If |
104 | .I pathname | |
105 | is relative and | |
106 | .I dirfd | |
107 | is the special value | |
108 | .BR AT_FDCWD , | |
109 | then | |
110 | .I pathname | |
111 | is interpreted relative to the current working | |
112 | directory of the calling process (like | |
cadd38ba | 113 | .BR mkfifo ()). |
847e0d88 | 114 | .PP |
464bbf04 MK |
115 | If |
116 | .I pathname | |
117 | is absolute, then | |
118 | .I dirfd | |
119 | is ignored. | |
47297adb | 120 | .SH RETURN VALUE |
d9c1ae64 MK |
121 | On success |
122 | .BR mkfifo () | |
464bbf04 MK |
123 | and |
124 | .BR mkfifoat () | |
125 | return 0. | |
f262c004 | 126 | In the case of an error, \-1 is returned (in which case, \fIerrno\fP |
fea681da MK |
127 | is set appropriately). |
128 | .SH ERRORS | |
129 | .TP | |
130 | .B EACCES | |
131 | One of the directories in \fIpathname\fP did not allow search | |
132 | (execute) permission. | |
133 | .TP | |
a1f01685 | 134 | .B EDQUOT |
9ee4a2b6 | 135 | The user's quota of disk blocks or inodes on the filesystem has been |
a1f01685 MH |
136 | exhausted. |
137 | .TP | |
fea681da MK |
138 | .B EEXIST |
139 | \fIpathname\fP already exists. | |
9d6299e8 MK |
140 | This includes the case where |
141 | .I pathname | |
142 | is a symbolic link, dangling or not. | |
fea681da MK |
143 | .TP |
144 | .B ENAMETOOLONG | |
145 | Either the total length of \fIpathname\fP is greater than | |
2c5f1089 | 146 | \fBPATH_MAX\fP, or an individual filename component has a length |
c13182ef MK |
147 | greater than \fBNAME_MAX\fP. |
148 | In the GNU system, there is no imposed | |
9ee4a2b6 | 149 | limit on overall filename length, but some filesystems may place |
fea681da MK |
150 | limits on the length of a component. |
151 | .TP | |
152 | .B ENOENT | |
153 | A directory component in \fIpathname\fP does not exist or is a | |
154 | dangling symbolic link. | |
155 | .TP | |
156 | .B ENOSPC | |
9ee4a2b6 | 157 | The directory or filesystem has no room for the new file. |
fea681da MK |
158 | .TP |
159 | .B ENOTDIR | |
160 | A component used as a directory in \fIpathname\fP is not, in fact, a | |
161 | directory. | |
162 | .TP | |
163 | .B EROFS | |
9ee4a2b6 | 164 | \fIpathname\fP refers to a read-only filesystem. |
464bbf04 MK |
165 | .PP |
166 | The following additional errors can occur for | |
167 | .BR mkfifoat (): | |
168 | .TP | |
169 | .B EBADF | |
170 | .I dirfd | |
171 | is not a valid file descriptor. | |
172 | .TP | |
173 | .B ENOTDIR | |
174 | .I pathname | |
175 | is a relative path and | |
176 | .I dirfd | |
177 | is a file descriptor referring to a file other than a directory. | |
178 | .SH VERSIONS | |
179 | .BR mkfifoat () | |
180 | was added to glibc in version 2.4. | |
181 | It is implemented using | |
94810bd7 | 182 | .BR mknodat (2), |
464bbf04 | 183 | available on Linux since kernel 2.6.16. |
2b9e0a13 | 184 | .SH ATTRIBUTES |
f1d8eed6 PH |
185 | For an explanation of the terms used in this section, see |
186 | .BR attributes (7). | |
187 | .TS | |
188 | allbox; | |
189 | lbw20 lb lb | |
190 | l l l. | |
191 | Interface Attribute Value | |
192 | T{ | |
193 | .BR mkfifo (), | |
2b9e0a13 | 194 | .BR mkfifoat () |
f1d8eed6 PH |
195 | T} Thread safety MT-Safe |
196 | .TE | |
47297adb | 197 | .SH CONFORMING TO |
464bbf04 | 198 | .BR mkfifo (): |
64b7542e | 199 | POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 200 | .PP |
464bbf04 MK |
201 | .BR mkfifoat (): |
202 | POSIX.1-2008. | |
47297adb | 203 | .SH SEE ALSO |
fea681da MK |
204 | .BR mkfifo (1), |
205 | .BR close (2), | |
206 | .BR open (2), | |
207 | .BR read (2), | |
208 | .BR stat (2), | |
209 | .BR umask (2), | |
210 | .BR write (2), | |
af5b2ef2 | 211 | .BR fifo (7) |