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