mkfifo(3)
๐ mkfifo(3) โ bestie edition
okay so. this is the mkfifo(3) page from the Library Functions Manual, and it's literally about making named pipes. yes, the manual name is right there in the title, we move on ๐ซถ
โจ NAME โจ
mkfifo, mkfifoat โ make a FIFO special file (a named pipe)
๐ LIBRARY ๐
Standard C library (libc, -lc)
๐ธ SYNOPSIS ๐ธ
#include <sys/types.h>
#include <sys/stat.h>
int mkfifo(const char *path, mode_t mode);
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/stat.h>
int mkfifoat(int dirfd, const char *path, mode_t mode);
๐ง Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
mkfifoat():
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
๐ DESCRIPTION ๐
So mkfifo() makes a FIFO special file with name path. and mode is what sets the FIFO's permissions. ngl it gets modified by the process's umask the usual way, so the permissions of the created file are literally (mode & ~umask). the math is mathing ๐
A FIFO special file is like a pipe, except it gets created differently. instead of being an anonymous communications channel, a FIFO special file gets entered into the filesystem when you call mkfifo(). it's giving glow-up, honestly โจ
Once you've created a FIFO special file like this, any process can open it for reading or writing, same as an ordinary file. HOWEVER โ plot twist ๐ญ โ it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. so like, don't just stand there bestie. check fifo(7) for nonblocking handling of FIFO special files, iykyk.
๐ฆ mkfifoat() ๐ฆ
mkfifoat() operates in exactly the same way as mkfifo(), except for the differences described here. and the differences are:
- If
pathis relative, then it's interpreted relative to the directory referred to by the file descriptordirfd(rather than relative to the current working directory of the calling process, as is done bymkfifo()for a relative pathname). - If
pathis relative anddirfdis the special valueAT_FDCWD, thenpathis interpreted relative to the current working directory of the calling process (likemkfifo()). - If
pathis absolute, thendirfdis ignored. periodt.
See openat(2) for an explanation of the need for mkfifoat().
๐ RETURN VALUE ๐
On success, mkfifo() and mkfifoat() return 0. that's the slay. ๐ฅณ
On error, -1 is returned and errno is set to indicate the error. the vibe check failed bestie ๐
๐ฅ ERRORS ๐ฅ
EACCESโ one of the directories inpathdid not allow search (execute) permission. rude.EBADFโ (mkfifoat())pathis relative butdirfdis neitherAT_FDCWDnor a valid file descriptor.EDQUOTโ the user's quota of disk blocks or inodes on the filesystem has been exhausted. no more room, no more slay.EEXISTโpathalready exists. and yes, this includes the case wherepathis a symbolic link, dangling or not. iconic behavior, honestly.ENAMETOOLONGโ either the total size ofpathis greater thanPATH_MAX, or an individual filename component has a length greater thanNAME_MAX. In the GNU system, there is no imposed limit on overall filename length, but some filesystems may place limits on the length of a component.ENOENTโ a directory component inpathdoes not exist or is a dangling symbolic link. she's not home ๐ENOSPCโ the directory or filesystem has no room for the new file.ENOTDIRโ a component used as a directory inpathis not, in fact, a directory.ENOTDIRโ (mkfifoat())pathis relative anddirfdis a file descriptor referring to a file other than a directory. yes this one shows up twice in the original, we don't make the rules ๐EROFSโpathrefers to a read-only filesystem. read-only era, respect it.
๐ ATTRIBUTES ๐
For an explanation of the terms used in this section, see attributes(7).
- Interface:
mkfifo(),mkfifoat() - Attribute: Thread safety
- Value:
MT-Safe
(that's the whole table, she's small but mighty ๐ซถ)
โญ VERSIONS โญ
It is implemented using mknodat(2). lowkey that's the whole tea.
๐ STANDARDS ๐
POSIX.1-2008.
๐ HISTORY ๐
mkfifo()โ POSIX.1-2001.mkfifoat()โ glibc 2.4. POSIX.1-2008.
๐ SEE ALSO ๐
mkfifo(1), close(2), open(2), read(2), stat(2), umask(2), write(2), fifo(7)
that's the whole page bestie, go make some pipes ๐
signing off with the receipts: this is from Linux man-pages 6.20, dated 2026-02-08, and the page name up top was mkfifo(3). no cap, not one detail dropped. mwah ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1995, James R. Van Zandt <jrv@vanzandt.mv.com>
- Copyright 2006-2014, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms