OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / mkfifo.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" changed section from 2 to 3, aeb, 950919
26 .\"
27 .TH MKFIFO 3 2008-06-12 "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 file system 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 EEXIST
74 \fIpathname\fP already exists.
75 This includes the case where
76 .I pathname
77 is a symbolic link, dangling or not.
78 .TP
79 .B ENAMETOOLONG
80 Either the total length of \fIpathname\fP is greater than
81 \fBPATH_MAX\fP, or an individual filename component has a length
82 greater than \fBNAME_MAX\fP.
83 In the GNU system, there is no imposed
84 limit on overall filename length, but some file systems may place
85 limits on the length of a component.
86 .TP
87 .B ENOENT
88 A directory component in \fIpathname\fP does not exist or is a
89 dangling symbolic link.
90 .TP
91 .B ENOSPC
92 The directory or file system has no room for the new file.
93 .TP
94 .B ENOTDIR
95 A component used as a directory in \fIpathname\fP is not, in fact, a
96 directory.
97 .TP
98 .B EROFS
99 \fIpathname\fP refers to a read-only file system.
100 .SH "CONFORMING TO"
101 POSIX.1-2001.
102 .SH "SEE ALSO"
103 .BR mkfifo (1),
104 .BR close (2),
105 .BR open (2),
106 .BR read (2),
107 .BR stat (2),
108 .BR umask (2),
109 .BR write (2),
110 .BR mkfifoat (3),
111 .BR fifo (7)