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

RETURN VALUE

60       On  success mkfifo() and mkfifoat() return 0.  In the case of an error,
61       -1 is returned (in which case, errno is set appropriately).
62

ERRORS

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

VERSIONS

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

ATTRIBUTES

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

CONFORMING TO

113       mkfifo(): POSIX.1-2001, POSIX.1-2008.
114
115       mkfifoat(): POSIX.1-2008.
116

SEE ALSO

118       mkfifo(1), close(2), open(2),  read(2),  stat(2),  umask(2),  write(2),
119       fifo(7)
120

COLOPHON

122       This  page  is  part of release 4.15 of the Linux man-pages project.  A
123       description of the project, information about reporting bugs,  and  the
124       latest     version     of     this    page,    can    be    found    at
125       https://www.kernel.org/doc/man-pages/.
126
127
128
129GNU                               2017-09-15                         MKFIFO(3)
Impressum