OSDN Git Service

(split) LDP: Update original to LDP v3.54
[linuxjm/LDP_man-pages.git] / original / man3 / mkfifo.3
1 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" changed section from 2 to 3, aeb, 950919
26 .\"
27 .TH MKFIFO 3 2013-01-27 "GNU" "Linux Programmer's Manual"
28 .SH NAME
29 mkfifo \- make a FIFO special file (a named pipe)
30 .SH SYNOPSIS
31 .nf
32 .B #include <sys/types.h>
33 .B #include <sys/stat.h>
34 .sp
35 .BI "int mkfifo(const char *" pathname ", mode_t " mode );
36 .fi
37 .SH DESCRIPTION
38 .BR mkfifo ()
39 makes a FIFO special file with name \fIpathname\fP.
40 \fImode\fP specifies the FIFO's permissions.
41 It is modified by the
42 process's \fBumask\fP in the usual way: the permissions of the created
43 file are \fB(\fP\fImode\fP\fB & ~umask)\fP.
44 .PP
45 A FIFO special file is similar to a pipe, except that it is created
46 in a different way.
47 Instead of being an anonymous communications
48 channel, a FIFO special file is entered into the filesystem by
49 calling
50 .BR mkfifo ().
51 .PP
52 Once you have created a FIFO special file in this way, any process can
53 open it for reading or writing, in the same way as an ordinary file.
54 However, it has to be open at both ends simultaneously before you can
55 proceed to do any input or output operations on it.
56 Opening a FIFO for reading normally blocks until some
57 other process opens the same FIFO for writing, and vice versa.
58 See
59 .BR fifo (7)
60 for nonblocking handling of FIFO special files.
61 .SH RETURN VALUE
62 On success
63 .BR mkfifo ()
64 returns 0.
65 In the case of an error, \-1 is returned (in which case, \fIerrno\fP
66 is set appropriately).
67 .SH ERRORS
68 .TP
69 .B EACCES
70 One of the directories in \fIpathname\fP did not allow search
71 (execute) permission.
72 .TP
73 .B EDQUOT
74 The user's quota of disk blocks or inodes on the filesystem has been
75 exhausted.
76 .TP
77 .B EEXIST
78 \fIpathname\fP already exists.
79 This includes the case where
80 .I pathname
81 is a symbolic link, dangling or not.
82 .TP
83 .B ENAMETOOLONG
84 Either the total length of \fIpathname\fP is greater than
85 \fBPATH_MAX\fP, or an individual filename component has a length
86 greater than \fBNAME_MAX\fP.
87 In the GNU system, there is no imposed
88 limit on overall filename length, but some filesystems may place
89 limits on the length of a component.
90 .TP
91 .B ENOENT
92 A directory component in \fIpathname\fP does not exist or is a
93 dangling symbolic link.
94 .TP
95 .B ENOSPC
96 The directory or filesystem has no room for the new file.
97 .TP
98 .B ENOTDIR
99 A component used as a directory in \fIpathname\fP is not, in fact, a
100 directory.
101 .TP
102 .B EROFS
103 \fIpathname\fP refers to a read-only filesystem.
104 .SH CONFORMING TO
105 POSIX.1-2001.
106 .SH SEE ALSO
107 .BR mkfifo (1),
108 .BR close (2),
109 .BR open (2),
110 .BR read (2),
111 .BR stat (2),
112 .BR umask (2),
113 .BR write (2),
114 .BR mkfifoat (3),
115 .BR fifo (7)