MKFIFO(2) | System Calls Manual | MKFIFO(2) |
mkfifo
, mkfifoat
— make a FIFO file
#include
<sys/stat.h>
int
mkfifo
(const
char *path, mode_t
mode);
#include
<sys/stat.h>
#include <fcntl.h>
int
mkfifoat
(int
fd, const char
*path, mode_t
mode);
mkfifo
()
creates a new FIFO file with name path. The access
permissions are specified by mode and restricted by
the umask(2) of the calling
process.
The FIFO's owner ID is set to the process's effective user ID. The FIFO's group ID is set to that of the parent directory in which it is created.
The
mkfifoat
()
function is equivalent to mkfifo
() except that where
path specifies a relative path, the newly created FIFO
is created relative to the directory associated with file descriptor
fd instead of the current working directory.
If
mkfifoat
()
is passed the special value AT_FDCWD
(defined in
<fcntl.h>
) in the
fd parameter, the current working directory is used
and the behavior is identical to a call to
mkfifo
().
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
mkfifo
() and
mkfifoat
() will fail and no FIFO will be created
if:
EOPNOTSUPP
]ENOTDIR
]ENAMETOOLONG
]NAME_MAX
characters, or an entire pathname (including the terminating NUL) exceeded
PATH_MAX
bytes.ENOENT
]EACCES
]ELOOP
]EROFS
]EEXIST
]ENOSPC
]ENOSPC
]EDQUOT
]EDQUOT
]EIO
]EIO
]EFAULT
]Additionally, mkfifoat
() will fail if:
EBADF
]AT_FDCWD
nor a valid file descriptor.ENOTDIR
]EACCES
]The mkfifo
() and
mkfifoat
() functions conform to
IEEE Std 1003.1-2008 (“POSIX.1”).
The mkfifoat
() function appeared in
OpenBSD 5.0.
May 31, 2015 | OpenBSD-6.8 |