1.\" $NetBSD: mkfifo.2,v 1.26 2013/07/30 13:15:07 njoly Exp $ 2.\" 3.\" Copyright (c) 1990, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)mkfifo.2 8.1 (Berkeley) 6/4/93 31.\" 32.Dd July 29, 2013 33.Dt MKFIFO 2 34.Os 35.Sh NAME 36.Nm mkfifo , 37.Nm mkfifoat 38.Nd make a fifo file 39.Sh LIBRARY 40.Lb libc 41.Sh SYNOPSIS 42.In sys/stat.h 43.Ft int 44.Fn mkfifo "const char *path" "mode_t mode" 45.Ft int 46.Fn mkfifoat "int fd" "const char *path" "mode_t mode" 47.Sh DESCRIPTION 48.Fn mkfifo 49creates a new fifo file with name 50.Fa path . 51The access permissions are 52specified by 53.Fa mode 54and restricted by the 55.Xr umask 2 56of the calling process. 57.Pp 58.Fn mkfifoat 59works the same way as 60.Fn mkfifo 61except if 62.Fa path 63is relative. 64In that case, it is looked up from a directory whose file 65descriptor was passed as 66.Fa fd . 67Search permission is required on this directory. 68.\" (These alternatives await a decision about the semantics of O_SEARCH) 69.\" Search permission is required on this directory 70.\" except if 71.\" .Fa fd 72.\" was opened with the 73.\" .Dv O_SEARCH 74.\" flag. 75.\" - or - 76.\" This file descriptor must have been opened with the 77.\" .Dv O_SEARCH 78.\" flag. 79.Fa fd 80can be set to 81.Dv AT_FDCWD 82in order to specify the current directory. 83.Pp 84The fifo's owner ID is set to the process's effective user ID. 85The fifo's group ID is set to that of the parent directory in 86which it is created. 87.Sh RETURN VALUES 88.Rv -std mkfifo mkfifoat 89.Sh ERRORS 90.Fn mkfifo 91and 92.Fn mkfifoat 93will fail and no fifo will be created if: 94.Bl -tag -width Er 95.It Bq Er EACCES 96Search permission is denied for a component of the path prefix. 97.It Bq Er EDQUOT 98The directory in which the entry for the new fifo 99is being placed cannot be extended because the 100user's quota of disk blocks on the file system 101containing the directory has been exhausted. 102Or, the user's quota of inodes on the file system on 103which the fifo is being created has been exhausted. 104.It Bq Er EEXIST 105The named file exists. 106.It Bq Er EFAULT 107.Fa path 108points outside the process's allocated address space. 109.It Bq Er EIO 110An 111.Tn I/O 112error occurred while making the directory entry or allocating the inode. 113Or, an 114.Tn I/O 115error occurred while reading from or writing to the file system. 116.It Bq Er ELOOP 117Too many symbolic links were encountered in translating the pathname. 118.It Bq Er ENAMETOOLONG 119A component of a pathname exceeded 120.Brq Dv NAME_MAX 121characters, or an entire path name exceeded 122.Brq Dv PATH_MAX 123characters. 124.It Bq Er ENOENT 125A component of the path prefix does not exist. 126.It Bq Er ENOSPC 127The directory in which the entry for the new fifo is being placed 128cannot be extended because there is no space left on the file 129system containing the directory. 130Or, there are no free inodes on the file system on which the 131fifo is being created. 132.It Bq Er ENOTDIR 133A component of the path prefix is not a directory. 134.It Bq Er EOPNOTSUPP 135The kernel has not been configured to support fifo's. 136.It Bq Er EROFS 137The named file resides on a read-only file system. 138.El 139.Pp 140In addition, 141.Fn mkfifoat 142will fail if: 143.Bl -tag -width Er 144.It Bq Er EBADF 145.Fa path 146does not specify an absolute path and 147.Fa fd 148is neither 149.Dv AT_FDCWD 150nor a valid file descriptor open for reading or searching. 151.It Bq Er ENOTDIR 152.Fa path 153is not an absolute path and 154.Fa fd 155is a file descriptor associated with a non-directory file. 156.El 157.Sh SEE ALSO 158.Xr chmod 2 , 159.Xr stat 2 , 160.Xr umask 2 161.Sh STANDARDS 162The 163.Nm mkfifo 164function call conforms to 165.St -p1003.1-90 . 166.Fn mkfifoat 167conforms to 168.St -p1003.1-2008 . 169