2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
45 .\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved.
46 .\" Copyright (c) 2014, Joyent, Inc.
48 .TH MKFIFO 3C "Apr 24, 2002"
50 mkfifo, mkfifoat \- make a FIFO special file
54 #include <sys/types.h>
57 \fBint\fR \fBmkfifo\fR(\fBconst char *\fR\fIpath\fR, \fBmode_t\fR \fImode\fR);
61 \fBint\fR \fBmkfifoat\fR(\fBint\fR \fIfd\fR, \fBconst char *\fR\fIpath\fR, \fBmode_t\fR \fImode\fR);
66 The \fBmkfifo()\fR and \fBmkfifoat()\fR functions create a new FIFO special file
67 named by the pathname pointed to by \fIpath\fR. The file permission bits of the
68 new FIFO are initialized from \fImode\fR. The file permission bits of the
69 \fImode\fR argument are modified by the process's file creation mask (see
70 \fBumask\fR(2)). Bits other than the file permission bits in \fImode\fR are
74 If \fIpath\fR names a symbolic link, \fBmkfifo()\fR and \fBmkfifoat()\fR fail
75 and set \fBerrno\fR to \fBEEXIST\fR.
78 The FIFO's user ID is set to the process's effective user ID. The FIFO's group
79 ID is set to the group ID of the parent directory or to the effective group ID
83 The \fBmkfifoat()\fR function is equivalent to \fBmkfifo()\fR; however, if
84 \fIpath\fR is a relative path, then it is resolved start at the directory
85 represented by \fIfd\fR. \fIfd\fR may be set to the special value of
86 \fBAT_FDCWD\fR which indicates that the current working directory should be used
87 to start resolving \fIpath\fR.
90 The \fBmkfifo()\fR function calls \fBmknod\fR(2) to create the file. The
91 \fBmkfifoat()\fR function calls \fBmknodat\fR(2) to create the file.
94 Upon successful completion, \fBmkfifo()\fR and \fBmkfifoat()\fR mark for update
95 the \fBst_atime\fR, \fBst_ctime\fR, and \fBst_mtime\fR fields of the file. Also,
96 the \fBst_ctime\fR and \fBst_mtime\fR fields of the directory that contains the
97 new entry are marked for update.
100 Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is
101 returned and \fBerrno\fR is set to indicate the error.
104 The \fBmkfifo()\fR and \fBmkfifoat()\fR functions will fail if:
111 A component of the path prefix denies search permission, or write permission is
112 denied on the parent directory of the FIFO to be created.
121 The named file already exists.
130 A loop exists in symbolic links encountered during resolution of the \fIpath\fR
137 \fB\fBENAMETOOLONG\fR\fR
140 The length of the \fIpath\fR argument exceeds {\fBPATH_MAX\fR} or a pathname
141 component is longer than {\fBNAME_MAX\fR}.
150 A component of the path prefix specified by \fIpath\fR does not name an
151 existing directory or \fIpath\fR is an empty string.
160 The directory that would contain the new file cannot be extended or the file
161 system is out of file-allocation resources.
170 A component of the path prefix is not a directory. For \fBmkfifoat()\fR,
171 \fIpath\fR is a relative path and \fIfd\fR is a valid file descriptor which is
181 The named file resides on a read-only file system.
186 The \fBmkfifoat()\fR function will fail if:
193 The \fIpath\fR argument is a relative path and \fIfd\fR is not a valid file
194 descriptor or the value \fBAT_FDCWD\fR.
199 The \fBmkfifo()\fR function may fail if:
206 Too many symbolic links were encountered in resolving \fIpath\fR.
212 \fB\fBENAMETOOLONG\fR\fR
215 The length of the \fIpath\fR argument exceeds {\fBPATH_MAX\fR} or a pathname
216 component is longer than {\fBNAME_MAX\fR}.
221 \fBExample 1 \fRCreate a FIFO File
224 The following example demonstrates how to create a FIFO file named
225 \fB/home/cnd/mod_done\fR with read and write permissions for the owner and read
226 permissions for the group and others.
231 #include sys/types.h>
235 status = mkfifo("/home/cnd/mod_done", S_IWUSR | S_IRUSR |
242 See \fBattributes\fR(5) for descriptions of the following attributes:
250 ATTRIBUTE TYPE ATTRIBUTE VALUE
252 Interface Stability Standard
259 \fBmkdir\fR(1), \fBchmod\fR(2), \fBexec\fR(2), \fBmknod\fR(2), \fBumask\fR(2),
260 \fBstat.h\fR(3HEAD), \fBufs\fR(7FS), \fBattributes\fR(5), \fBstandards\fR(5)