OSDN Git Service

18940f7070a937f312ce2c838459cfb7cfe007e3
[linuxjm/LDP_man-pages.git] / release / man3 / mkfifo.3
1 .\" This manpage is Copyright (C) 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
2 .\" and Copyright (C) 2006, 2014 Michael Kerrisk
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
25 .\"
26 .\" changed section from 2 to 3, aeb, 950919
27 .\"
28 .\"*******************************************************************
29 .\"
30 .\" This file was generated with po4a. Translate the source file.
31 .\"
32 .\"*******************************************************************
33 .\"
34 .\" Japanese Version Copyright (c) 1998 George Momma
35 .\"         all rights reserved.
36 .\" Translated Mon May 25 23:11:03 JST 1998
37 .\"         by George Momma <momma@wakhok.ac.jp>
38 .\" Updated 1999-12-11 by Kentaro Shirakata <argrath@ub32.org>
39 .\" Updated 2008-07-30 by Kentaro Shirakata <argrath@ub32.org>
40 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
41 .\"
42 .TH MKFIFO 3 2014\-03\-24 GNU "Linux Programmer's Manual"
43 .SH 名前
44 mkfifo, mkfifoat \- FIFOスペシャルファイル(名前付きパイプ)を作成する
45 .SH 書式
46 .nf
47 \fB#include <sys/types.h>\fP
48 \fB#include <sys/stat.h>\fP
49 .sp
50 \fBint mkfifo(const char *\fP\fIpathname\fP\fB, mode_t \fP\fImode\fP\fB);\fP
51 .sp
52 \fB#include <fcntl.h>           \fP/* AT_* 定数の定義 */
53 \fB#include <sys/stat.h>\fP
54 .sp
55 \fBint mkfifoat(int \fP\fIdirfd\fP\fB, const char *\fP\fIpathname\fP\fB, mode_t \fP\fImode\fP\fB);\fP
56 .fi
57 .sp
58 .in -4n
59 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
60 .in
61 .sp
62 \fBmkfifoat\fP():
63 .PD 0
64 .ad l
65 .RS 4
66 .TP  4
67 glibc 2.10 以降:
68 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
69 .TP 
70 glibc 2.10 より前:
71 _ATFILE_SOURCE
72 .RE
73 .ad
74 .PD
75 .SH 説明
76 \fBmkfifo\fP()  は名前 \fIpathname\fP を持つFIFOスペシャルファイルを作成 する。FIFOの許可モードは \fImode\fP
77 で指定され、プロセスの \fBumask\fP によって通常の方式で変更を受ける: 作成されたファイルの許可 モードは \fB(\fP\fImode\fP\fB &
78 ~umask)\fP となる。
79 .PP
80 FIFOスペシャルファイルはパイプに似ているが、作成のされ方のみが異なって いる。FIFOスペシャルファイルは名前のない通信路ではなく、
81 \fBmkfifo\fP()  の呼び出しによりファイルシステムの中に加えられる。
82 .PP
83 ひとたびこのようにしてFIFOスペシャルファイルが作成されると、通常のファ イルと同じように、どのプロセスからでも読み出し、書き込み用にこれをオー
84 プンすることができる。ただし、これに対する全ての入出力操作に先立って その両端がオープンされている必要がある。FIFOを読み出し用にオープンする
85 と、通常他のプロセスによって同じFIFOが書き込み用にオープンされるまでブ ロックされ、逆の場合も同様である。
86 FIFOスペシャルファイルをブロックせずに扱う方法については \fBfifo\fP(7)  を参照のこと。
87 .SS mkfifoat()
88 \fBmkfifoat\fP() システムコールは \fBmkfifo\fP() と全く同様に動作するが、以下で説明する点が異なる。
89
90 \fIpathname\fP で指定されたパス名が相対パスの場合、このパス名はファイルディスクリプター \fIdirfd\fP
91 が参照するディレクトリに対する相対パスと解釈される (\fBmkfifo\fP()
92 に相対パス名を渡した場合のように、呼び出したプロセスのカレントワーキングディレクトリに対する相対パスではない)。
93
94 \fIpathname\fP で指定されたパス名が相対パスで、 \fIdirfd\fP が特別な値 \fBAT_FDCWD\fP の場合、 (\fBmkfifo\fP()
95 と同様に) \fIpathname\fP は呼び出したプロセスのカレントワーキングディレクトリに対する相対パスと解釈される。
96
97 \fIpathname\fP で指定されたパス名が絶対パスの場合、 \fIdirfd\fP は無視される。
98 .SH 返り値
99 成功した場合 \fBmkfifo\fP() と \fBmkfifoat\fP() は 0 を返す。 エラーの場合 \-1 を返す (また \fIerrno\fP
100 が適切に設定される)。
101 .SH エラー
102 .TP 
103 \fBEACCES\fP
104 \fIpathname\fP の中のディレクトリの一つに対し検索(実行)許可がない。
105 .TP 
106 \fBEDQUOT\fP
107 ディスクブロックか inode がそのファイルシステムのユーザクォータに達していた。
108 .TP 
109 \fBEEXIST\fP
110 \fIpathname\fP がすでに存在する。 これには \fIpathname\fP がシンボリックリンクである場合も含まれる
111 (シンボリックリンクがリンク切れか (dangling) どうかは関係ない)。
112 .TP 
113 \fBENAMETOOLONG\fP
114 \fIpathname\fP の長さが \fBPATH_MAX\fP を超えているか、個々のファイル 名部分の長さが \fBNAME_MAX\fP
115 を超えている。GNUシステムにおいては、ファ イル名の全体の長さに対しては制限は課せられていないが、ファイルシステム
116 によっては各部分の長さに制限のある可能性がある。
117 .TP 
118 \fBENOENT\fP
119 \fIpathname\fP 中のディレクトリ部分が存在しない、 もしくはリンク先の無いシンボリックリンクである。
120 .TP 
121 \fBENOSPC\fP
122 ディレクトリまたはファイルシステムに新規ファイルを作成する余地がない。
123 .TP 
124 \fBENOTDIR\fP
125 \fIpathname\fP 中のディレクトリ要素が、実際にはディレクトリでない。
126 .TP 
127 \fBEROFS\fP
128 \fIpathname\fP が読み取り専用のファイルシステムを指している。
129 .PP
130 \fBmkfifoat\fP() では以下のエラーも発生する。
131 .TP 
132 \fBEBADF\fP
133 \fIdirfd\fP が有効なファイルディスクリプタでない。
134 .TP 
135 \fBENOTDIR\fP
136 \fIpathname\fP が相対パスで、 \fIdirfd\fP がディレクトリ以外のファイルを参照しているファイルディスクリプタである。
137 .SH バージョン
138 \fBmkfifoat\fP() は glibc 2.4 で追加された。これは、カーネル 2.6.16 以降の Linux で利用できる
139 \fBmknodat\fP(2) を使って実装されている。
140 .SH 属性
141 .SS "マルチスレッディング (pthreads(7) 参照)"
142 関数 \fBmkfifo\fP() と \fBmkfifoat\fP() はスレッドセーフである。
143 .SH 準拠
144 \fBmkfifo\fP(): POSIX.1\-2001, POSIX.1\-2008.
145
146 \fBmkfifoat\fP(): POSIX.1\-2008.
147 .SH 関連項目
148 \fBmkfifo\fP(1), \fBclose\fP(2), \fBopen\fP(2), \fBread\fP(2), \fBstat\fP(2), \fBumask\fP(2),
149 \fBwrite\fP(2), \fBfifo\fP(7)
150 .SH この文書について
151 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
152 である。プロジェクトの説明とバグ報告に関する情報は
153 http://www.kernel.org/doc/man\-pages/ に書かれている。