1.\" $NetBSD: mkfifo.2,v 1.27 2013/10/15 11:43:21 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.In sys/stat.h 46.In fcntl.h 47.Ft int 48.Fn mkfifoat "int fd" "const char *path" "mode_t mode" 49.Sh DESCRIPTION 50.Fn mkfifo 51creates a new fifo file with name 52.Fa path . 53The access permissions are 54specified by 55.Fa mode 56and restricted by the 57.Xr umask 2 58of the calling process. 59.Pp 60.Fn mkfifoat 61works the same way as 62.Fn mkfifo 63except if 64.Fa path 65is relative. 66In that case, it is looked up from a directory whose file 67descriptor was passed as 68.Fa fd . 69Search permission is required on this directory. 70.\" (These alternatives await a decision about the semantics of O_SEARCH) 71.\" Search permission is required on this directory 72.\" except if 73.\" .Fa fd 74.\" was opened with the 75.\" .Dv O_SEARCH 76.\" flag. 77.\" - or - 78.\" This file descriptor must have been opened with the 79.\" .Dv O_SEARCH 80.\" flag. 81.Fa fd 82can be set to 83.Dv AT_FDCWD 84in order to specify the current directory. 85.Pp 86The fifo's owner ID is set to the process's effective user ID. 87The fifo's group ID is set to that of the parent directory in 88which it is created. 89.Sh RETURN VALUES 90.Rv -std mkfifo mkfifoat 91.Sh ERRORS 92.Fn mkfifo 93and 94.Fn mkfifoat 95will fail and no fifo will be created if: 96.Bl -tag -width Er 97.It Bq Er EACCES 98Search permission is denied for a component of the path prefix. 99.It Bq Er EDQUOT 100The directory in which the entry for the new fifo 101is being placed cannot be extended because the 102user's quota of disk blocks on the file system 103containing the directory has been exhausted. 104Or, the user's quota of inodes on the file system on 105which the fifo is being created has been exhausted. 106.It Bq Er EEXIST 107The named file exists. 108.It Bq Er EFAULT 109.Fa path 110points outside the process's allocated address space. 111.It Bq Er EIO 112An 113.Tn I/O 114error occurred while making the directory entry or allocating the inode. 115Or, an 116.Tn I/O 117error occurred while reading from or writing to the file system. 118.It Bq Er ELOOP 119Too many symbolic links were encountered in translating the pathname. 120.It Bq Er ENAMETOOLONG 121A component of a pathname exceeded 122.Brq Dv NAME_MAX 123characters, or an entire path name exceeded 124.Brq Dv PATH_MAX 125characters. 126.It Bq Er ENOENT 127A component of the path prefix does not exist. 128.It Bq Er ENOSPC 129The directory in which the entry for the new fifo is being placed 130cannot be extended because there is no space left on the file 131system containing the directory. 132Or, there are no free inodes on the file system on which the 133fifo is being created. 134.It Bq Er ENOTDIR 135A component of the path prefix is not a directory. 136.It Bq Er EOPNOTSUPP 137The kernel has not been configured to support fifo's. 138.It Bq Er EROFS 139The named file resides on a read-only file system. 140.El 141.Pp 142In addition, 143.Fn mkfifoat 144will fail if: 145.Bl -tag -width Er 146.It Bq Er EBADF 147.Fa path 148does not specify an absolute path and 149.Fa fd 150is neither 151.Dv AT_FDCWD 152nor a valid file descriptor open for reading or searching. 153.It Bq Er ENOTDIR 154.Fa path 155is not an absolute path and 156.Fa fd 157is a file descriptor associated with a non-directory file. 158.El 159.Sh SEE ALSO 160.Xr chmod 2 , 161.Xr stat 2 , 162.Xr umask 2 163.Sh STANDARDS 164The 165.Nm mkfifo 166function call conforms to 167.St -p1003.1-90 . 168.Fn mkfifoat 169conforms to 170.St -p1003.1-2008 . 171