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