1MKFIFO(3)                  Linux Programmer's Manual                 MKFIFO(3)
2
3
4

NAME

6       mkfifo, mkfifoat - make a FIFO special file (a named pipe)
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/stat.h>
11
12       int mkfifo(const char *pathname, mode_t mode);
13
14       #include <fcntl.h>           /* Definition of AT_* constants */
15       #include <sys/stat.h>
16
17       int mkfifoat(int dirfd, const char *pathname, mode_t mode);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       mkfifoat():
22           Since glibc 2.10:
23               _POSIX_C_SOURCE >= 200809L
24           Before glibc 2.10:
25               _ATFILE_SOURCE
26

DESCRIPTION

28       mkfifo()  makes a FIFO special file with name pathname.  mode specifies
29       the FIFO's permissions.  It is modified by the process's umask  in  the
30       usual way: the permissions of the created file are (mode & ~umask).
31
32       A  FIFO special file is similar to a pipe, except that it is created in
33       a different way.  Instead of being an anonymous communications channel,
34       a FIFO special file is entered into the filesystem by calling mkfifo().
35
36       Once  you have created a FIFO special file in this way, any process can
37       open it for reading or writing, in the same way as  an  ordinary  file.
38       However,  it  has to be open at both ends simultaneously before you can
39       proceed to do any input or output operations on it.  Opening a FIFO for
40       reading  normally  blocks  until some other process opens the same FIFO
41       for writing, and vice versa.  See fifo(7) for nonblocking  handling  of
42       FIFO special files.
43
44   mkfifoat()
45       The  mkfifoat()  function operates in exactly the same way as mkfifo(),
46       except for the differences described here.
47
48       If the pathname given in pathname is relative, then it  is  interpreted
49       relative  to  the  directory  referred  to by the file descriptor dirfd
50       (rather than relative to the current working directory of  the  calling
51       process, as is done by mkfifo() for a relative pathname).
52
53       If  pathname  is relative and dirfd is the special value AT_FDCWD, then
54       pathname is interpreted relative to the current  working  directory  of
55       the calling process (like mkfifo()).
56
57       If pathname is absolute, then dirfd is ignored.
58
59       See openat(2) for an explanation of the need for mkfifoat().
60

RETURN VALUE

62       On  success mkfifo() and mkfifoat() return 0.  On error, -1 is returned
63       and errno is set to indicate the error.
64

ERRORS

66       EACCES One of the directories in pathname did not  allow  search  (exe‐
67              cute) permission.
68
69       EBADF  (mkfifoat())  pathname is relative but dirfd is neither AT_FDCWD
70              nor a valid file descriptor.
71
72       EDQUOT The user's quota of disk blocks or inodes on the filesystem  has
73              been exhausted.
74
75       EEXIST pathname  already exists.  This includes the case where pathname
76              is a symbolic link, dangling or not.
77
78       ENAMETOOLONG
79              Either the total length of pathname is greater than PATH_MAX, or
80              an  individual  filename  component  has  a  length greater than
81              NAME_MAX.  In the GNU system, there is no imposed limit on over‐
82              all  filename  length,  but some filesystems may place limits on
83              the length of a component.
84
85       ENOENT A directory component in pathname does not exist or  is  a  dan‐
86              gling symbolic link.
87
88       ENOSPC The directory or filesystem has no room for the new file.
89
90       ENOTDIR
91              A  component  used as a directory in pathname is not, in fact, a
92              directory.
93
94       ENOTDIR
95              (mkfifoat()) pathname is a relative pathname and dirfd is a file
96              descriptor referring to a file other than a directory.
97
98       EROFS  pathname refers to a read-only filesystem.
99

VERSIONS

101       mkfifoat()  was added to glibc in version 2.4.  It is implemented using
102       mknodat(2), available on Linux since kernel 2.6.16.
103

ATTRIBUTES

105       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
106       tributes(7).
107
108       ┌────────────────────────────────────────────┬───────────────┬─────────┐
109Interface                                   Attribute     Value   
110       ├────────────────────────────────────────────┼───────────────┼─────────┤
111mkfifo(), mkfifoat()                        │ Thread safety │ MT-Safe │
112       └────────────────────────────────────────────┴───────────────┴─────────┘
113

CONFORMING TO

115       mkfifo(): POSIX.1-2001, POSIX.1-2008.
116
117       mkfifoat(): POSIX.1-2008.
118

SEE ALSO

120       mkfifo(1), close(2), open(2), read(2), stat(2), umask(2), write(2), fi‐
121       fo(7)
122

COLOPHON

124       This page is part of release 5.13 of the Linux  man-pages  project.   A
125       description  of  the project, information about reporting bugs, and the
126       latest    version    of    this    page,    can     be     found     at
127       https://www.kernel.org/doc/man-pages/.
128
129
130
131GNU                               2021-08-27                         MKFIFO(3)
Impressum