xref: /freebsd/lib/libsys/mkfifo.2 (revision 8269e7673cf033aba67dab8264fe719920c70f87)
1*8269e767SBrooks Davis.\" Copyright (c) 1990, 1991, 1993
2*8269e767SBrooks Davis.\"	The Regents of the University of California.  All rights reserved.
3*8269e767SBrooks Davis.\"
4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions
6*8269e767SBrooks Davis.\" are met:
7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
8*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
9*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
10*8269e767SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
11*8269e767SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
12*8269e767SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors
13*8269e767SBrooks Davis.\"    may be used to endorse or promote products derived from this software
14*8269e767SBrooks Davis.\"    without specific prior written permission.
15*8269e767SBrooks Davis.\"
16*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*8269e767SBrooks Davis.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*8269e767SBrooks Davis.\" SUCH DAMAGE.
27*8269e767SBrooks Davis.\"
28*8269e767SBrooks Davis.Dd March 30, 2020
29*8269e767SBrooks Davis.Dt MKFIFO 2
30*8269e767SBrooks Davis.Os
31*8269e767SBrooks Davis.Sh NAME
32*8269e767SBrooks Davis.Nm mkfifo ,
33*8269e767SBrooks Davis.Nm mkfifoat
34*8269e767SBrooks Davis.Nd make a fifo file
35*8269e767SBrooks Davis.Sh LIBRARY
36*8269e767SBrooks Davis.Lb libc
37*8269e767SBrooks Davis.Sh SYNOPSIS
38*8269e767SBrooks Davis.In sys/types.h
39*8269e767SBrooks Davis.In sys/stat.h
40*8269e767SBrooks Davis.Ft int
41*8269e767SBrooks Davis.Fn mkfifo "const char *path" "mode_t mode"
42*8269e767SBrooks Davis.Ft int
43*8269e767SBrooks Davis.Fn mkfifoat "int fd" "const char *path" "mode_t mode"
44*8269e767SBrooks Davis.Sh DESCRIPTION
45*8269e767SBrooks DavisThe
46*8269e767SBrooks Davis.Fn mkfifo
47*8269e767SBrooks Davissystem call
48*8269e767SBrooks Daviscreates a new fifo file with name
49*8269e767SBrooks Davis.Fa path .
50*8269e767SBrooks DavisThe access permissions are
51*8269e767SBrooks Davisspecified by
52*8269e767SBrooks Davis.Fa mode
53*8269e767SBrooks Davisand restricted by the
54*8269e767SBrooks Davis.Xr umask 2
55*8269e767SBrooks Davisof the calling process.
56*8269e767SBrooks Davis.Pp
57*8269e767SBrooks DavisThe fifo's owner ID is set to the process's effective user ID.
58*8269e767SBrooks DavisThe fifo's group ID is set to that of the parent directory in
59*8269e767SBrooks Daviswhich it is created.
60*8269e767SBrooks Davis.Pp
61*8269e767SBrooks DavisThe
62*8269e767SBrooks Davis.Fn mkfifoat
63*8269e767SBrooks Davissystem call is equivalent to
64*8269e767SBrooks Davis.Fn mkfifo
65*8269e767SBrooks Davisexcept in the case where
66*8269e767SBrooks Davis.Fa path
67*8269e767SBrooks Davisspecifies a relative path.
68*8269e767SBrooks DavisIn this case the newly created FIFO is created relative to the
69*8269e767SBrooks Davisdirectory associated with the file descriptor
70*8269e767SBrooks Davis.Fa fd
71*8269e767SBrooks Davisinstead of the current working directory.
72*8269e767SBrooks DavisIf
73*8269e767SBrooks Davis.Fn mkfifoat
74*8269e767SBrooks Davisis passed the special value
75*8269e767SBrooks Davis.Dv AT_FDCWD
76*8269e767SBrooks Davisin the
77*8269e767SBrooks Davis.Fa fd
78*8269e767SBrooks Davisparameter, the current working directory is used and the behavior is
79*8269e767SBrooks Davisidentical to a call to
80*8269e767SBrooks Davis.Fn mkfifo .
81*8269e767SBrooks Davis.Sh RETURN VALUES
82*8269e767SBrooks Davis.Rv -std mkfifo
83*8269e767SBrooks Davis.Sh ERRORS
84*8269e767SBrooks DavisThe
85*8269e767SBrooks Davis.Fn mkfifo
86*8269e767SBrooks Davissystem call
87*8269e767SBrooks Daviswill fail and no fifo will be created if:
88*8269e767SBrooks Davis.Bl -tag -width Er
89*8269e767SBrooks Davis.It Bq Er ENOTSUP
90*8269e767SBrooks DavisThe kernel has not been configured to support fifo's.
91*8269e767SBrooks Davis.It Bq Er ENOTDIR
92*8269e767SBrooks DavisA component of the path prefix is not a directory.
93*8269e767SBrooks Davis.It Bq Er ENAMETOOLONG
94*8269e767SBrooks DavisA component of a pathname exceeded 255 characters,
95*8269e767SBrooks Davisor an entire path name exceeded 1023 characters.
96*8269e767SBrooks Davis.It Bq Er ENOENT
97*8269e767SBrooks DavisA component of the path prefix does not exist.
98*8269e767SBrooks Davis.It Bq Er EACCES
99*8269e767SBrooks DavisA component of the path prefix denies search permission, or write permission
100*8269e767SBrooks Davisis denied on the parent directory of the fifo to be created.
101*8269e767SBrooks Davis.It Bq Er ELOOP
102*8269e767SBrooks DavisToo many symbolic links were encountered in translating the pathname.
103*8269e767SBrooks Davis.It Bq Er EROFS
104*8269e767SBrooks DavisThe named file would reside on a read-only file system.
105*8269e767SBrooks Davis.It Bq Er EEXIST
106*8269e767SBrooks DavisThe named file exists.
107*8269e767SBrooks Davis.It Bq Er EPERM
108*8269e767SBrooks DavisThe parent directory of the named file has its immutable flag set, see the
109*8269e767SBrooks Davis.Xr chflags 2
110*8269e767SBrooks Davismanual page for more information.
111*8269e767SBrooks Davis.It Bq Er ENOSPC
112*8269e767SBrooks DavisThe directory in which the entry for the new fifo is being placed
113*8269e767SBrooks Daviscannot be extended because there is no space left on the file
114*8269e767SBrooks Davissystem containing the directory.
115*8269e767SBrooks Davis.It Bq Er ENOSPC
116*8269e767SBrooks DavisThere are no free inodes on the file system on which the
117*8269e767SBrooks Davisfifo is being created.
118*8269e767SBrooks Davis.It Bq Er EDQUOT
119*8269e767SBrooks DavisThe directory in which the entry for the new fifo
120*8269e767SBrooks Davisis being placed cannot be extended because the
121*8269e767SBrooks Davisuser's quota of disk blocks on the file system
122*8269e767SBrooks Daviscontaining the directory has been exhausted.
123*8269e767SBrooks Davis.It Bq Er EDQUOT
124*8269e767SBrooks DavisThe user's quota of inodes on the file system on
125*8269e767SBrooks Daviswhich the fifo is being created has been exhausted.
126*8269e767SBrooks Davis.It Bq Er EIO
127*8269e767SBrooks DavisAn
128*8269e767SBrooks Davis.Tn I/O
129*8269e767SBrooks Daviserror occurred while making the directory entry or allocating the inode.
130*8269e767SBrooks Davis.It Bq Er EINTEGRITY
131*8269e767SBrooks DavisCorrupted data was detected while reading from the file system.
132*8269e767SBrooks Davis.It Bq Er EFAULT
133*8269e767SBrooks DavisThe
134*8269e767SBrooks Davis.Fa path
135*8269e767SBrooks Davisargument
136*8269e767SBrooks Davispoints outside the process's allocated address space.
137*8269e767SBrooks Davis.El
138*8269e767SBrooks Davis.Pp
139*8269e767SBrooks DavisIn addition to the errors returned by the
140*8269e767SBrooks Davis.Fn mkfifo ,
141*8269e767SBrooks Davisthe
142*8269e767SBrooks Davis.Fn mkfifoat
143*8269e767SBrooks Davismay fail if:
144*8269e767SBrooks Davis.Bl -tag -width Er
145*8269e767SBrooks Davis.It Bq Er EBADF
146*8269e767SBrooks DavisThe
147*8269e767SBrooks Davis.Fa path
148*8269e767SBrooks Davisargument does not specify an absolute path and the
149*8269e767SBrooks Davis.Fa fd
150*8269e767SBrooks Davisargument is neither
151*8269e767SBrooks Davis.Dv AT_FDCWD
152*8269e767SBrooks Davisnor a valid file descriptor open for searching.
153*8269e767SBrooks Davis.It Bq Er ENOTDIR
154*8269e767SBrooks DavisThe
155*8269e767SBrooks Davis.Fa path
156*8269e767SBrooks Davisargument is not an absolute path and
157*8269e767SBrooks Davis.Fa fd
158*8269e767SBrooks Davisis neither
159*8269e767SBrooks Davis.Dv AT_FDCWD
160*8269e767SBrooks Davisnor a file descriptor associated with a directory.
161*8269e767SBrooks Davis.El
162*8269e767SBrooks Davis.Sh SEE ALSO
163*8269e767SBrooks Davis.Xr chflags 2 ,
164*8269e767SBrooks Davis.Xr chmod 2 ,
165*8269e767SBrooks Davis.Xr mknod 2 ,
166*8269e767SBrooks Davis.Xr stat 2 ,
167*8269e767SBrooks Davis.Xr umask 2
168*8269e767SBrooks Davis.Sh STANDARDS
169*8269e767SBrooks DavisThe
170*8269e767SBrooks Davis.Fn mkfifo
171*8269e767SBrooks Davissystem call is expected to conform to
172*8269e767SBrooks Davis.St -p1003.1-90 .
173*8269e767SBrooks DavisThe
174*8269e767SBrooks Davis.Fn mkfifoat
175*8269e767SBrooks Davissystem call follows The Open Group Extended API Set 2 specification.
176*8269e767SBrooks Davis.Sh HISTORY
177*8269e767SBrooks DavisThe
178*8269e767SBrooks Davis.Fn mkfifoat
179*8269e767SBrooks Davissystem call appeared in
180*8269e767SBrooks Davis.Fx 8.0 .
181