1.\" $OpenBSD: mkfifo.2,v 1.15 2015/05/31 23:54:25 schwarze 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: May 31 2015 $ 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.In sys/stat.h 42.Ft int 43.Fn mkfifo "const char *path" "mode_t mode" 44.In sys/stat.h 45.In fcntl.h 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 87.Rv -std 88.Sh ERRORS 89.Fn mkfifo 90and 91.Fn mkfifoat 92will fail and no FIFO will be created if: 93.Bl -tag -width Er 94.It Bq Er EOPNOTSUPP 95The kernel has not been configured to support FIFOs. 96.It Bq Er ENOTDIR 97A component of the path prefix is not a directory. 98.It Bq Er ENAMETOOLONG 99A component of a pathname exceeded 100.Dv NAME_MAX 101characters, or an entire pathname (including the terminating NUL) 102exceeded 103.Dv PATH_MAX 104bytes. 105.It Bq Er ENOENT 106A component of the path prefix does not exist. 107.It Bq Er EACCES 108Search permission is denied for a component of the path prefix. 109.It Bq Er ELOOP 110Too many symbolic links were encountered in translating the pathname. 111.It Bq Er EROFS 112The named file resides on a read-only file system. 113.It Bq Er EEXIST 114The named file exists. 115.It Bq Er ENOSPC 116The directory in which the entry for the new FIFO is being placed 117cannot be extended because there is no space left on the file 118system containing the directory. 119.It Bq Er ENOSPC 120There are no free inodes on the file system on which the 121FIFO is being created. 122.It Bq Er EDQUOT 123The directory in which the entry for the new FIFO 124is being placed cannot be extended because the 125user's quota of disk blocks on the file system 126containing the directory has been exhausted. 127.It Bq Er EDQUOT 128The user's quota of inodes on the file system on 129which the FIFO is being created has been exhausted. 130.It Bq Er EIO 131An I/O error occurred while making the directory entry or allocating 132the inode. 133.It Bq Er EIO 134An I/O error occurred while reading from or writing to the file system. 135.It Bq Er EFAULT 136.Fa path 137points outside the process's allocated address space. 138.El 139.Pp 140Additionally, 141.Fn mkfifoat 142will fail if: 143.Bl -tag -width Er 144.It Bq Er EBADF 145The 146.Fa path 147argument specifies a relative path and the 148.Fa fd 149argument is neither 150.Dv AT_FDCWD 151nor a valid file descriptor. 152.It Bq Er ENOTDIR 153The 154.Fa path 155argument specifies a relative path and the 156.Fa fd 157argument is a valid file descriptor but it does not reference a directory. 158.It Bq Er EACCES 159The 160.Fa path 161argument specifies a relative path but search permission is denied 162for the directory which the 163.Fa fd 164file descriptor references. 165.El 166.Sh SEE ALSO 167.Xr chmod 2 , 168.Xr stat 2 , 169.Xr umask 2 170.Sh STANDARDS 171The 172.Fn mkfifo 173and 174.Fn mkfifoat 175functions conform to 176.St -p1003.1-2008 . 177.Sh HISTORY 178The 179.Fn mkfifoat 180function appeared in 181.Ox 5.0 . 182