1mkfifo(3)                  Library Functions Manual                  mkfifo(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

65       On  success mkfifo() and mkfifoat() return 0.  On error, -1 is returned
66       and errno is set to indicate the error.
67

ERRORS

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

ATTRIBUTES

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

VERSIONS

114       It is implemented using mknodat(2).
115

STANDARDS

117       POSIX.1-2008.
118

HISTORY

120       mkfifo()
121              POSIX.1-2001.
122
123       mkfifoat()
124              glibc 2.4.  POSIX.1-2008.
125

SEE ALSO

127       mkfifo(1), close(2), open(2), read(2), stat(2), umask(2), write(2), fi‐
128       fo(7)
129
130
131
132Linux man-pages 6.04              2023-03-30                         mkfifo(3)
Impressum