.\" This manpage is Copyright (C) 1995 James R. Van Zandt .\" and Copyright (C) 2006, 2014 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" changed section from 2 to 3, aeb, 950919 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1998 George Momma .\" all rights reserved. .\" Translated Mon May 25 23:11:03 JST 1998 .\" by George Momma .\" Updated 1999-12-11 by Kentaro Shirakata .\" Updated 2008-07-30 by Kentaro Shirakata .\" Updated 2013-05-06, Akihiro MOTOKI .\" .TH MKFIFO 3 2014\-03\-24 GNU "Linux Programmer's Manual" .SH 名前 mkfifo, mkfifoat \- FIFOスペシャルファイル(名前付きパイプ)を作成する .SH 書式 .nf \fB#include \fP \fB#include \fP .sp \fBint mkfifo(const char *\fP\fIpathname\fP\fB, mode_t \fP\fImode\fP\fB);\fP .sp \fB#include \fP/* AT_* 定数の定義 */ \fB#include \fP .sp \fBint mkfifoat(int \fP\fIdirfd\fP\fB, const char *\fP\fIpathname\fP\fB, mode_t \fP\fImode\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBmkfifoat\fP(): .PD 0 .ad l .RS 4 .TP 4 glibc 2.10 以降: _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L .TP glibc 2.10 より前: _ATFILE_SOURCE .RE .ad .PD .SH 説明 \fBmkfifo\fP() は名前 \fIpathname\fP を持つFIFOスペシャルファイルを作成 する。FIFOの許可モードは \fImode\fP で指定され、プロセスの \fBumask\fP によって通常の方式で変更を受ける: 作成されたファイルの許可 モードは \fB(\fP\fImode\fP\fB & ~umask)\fP となる。 .PP FIFOスペシャルファイルはパイプに似ているが、作成のされ方のみが異なって いる。FIFOスペシャルファイルは名前のない通信路ではなく、 \fBmkfifo\fP() の呼び出しによりファイルシステムの中に加えられる。 .PP ひとたびこのようにしてFIFOスペシャルファイルが作成されると、通常のファ イルと同じように、どのプロセスからでも読み出し、書き込み用にこれをオー プンすることができる。ただし、これに対する全ての入出力操作に先立って その両端がオープンされている必要がある。FIFOを読み出し用にオープンする と、通常他のプロセスによって同じFIFOが書き込み用にオープンされるまでブ ロックされ、逆の場合も同様である。 FIFOスペシャルファイルをブロックせずに扱う方法については \fBfifo\fP(7) を参照のこと。 .SS mkfifoat() \fBmkfifoat\fP() システムコールは \fBmkfifo\fP() と全く同様に動作するが、以下で説明する点が異なる。 \fIpathname\fP で指定されたパス名が相対パスの場合、このパス名はファイルディスクリプター \fIdirfd\fP が参照するディレクトリに対する相対パスと解釈される (\fBmkfifo\fP() に相対パス名を渡した場合のように、呼び出したプロセスのカレントワーキングディレクトリに対する相対パスではない)。 \fIpathname\fP で指定されたパス名が相対パスで、 \fIdirfd\fP が特別な値 \fBAT_FDCWD\fP の場合、 (\fBmkfifo\fP() と同様に) \fIpathname\fP は呼び出したプロセスのカレントワーキングディレクトリに対する相対パスと解釈される。 \fIpathname\fP で指定されたパス名が絶対パスの場合、 \fIdirfd\fP は無視される。 .SH 返り値 成功した場合 \fBmkfifo\fP() と \fBmkfifoat\fP() は 0 を返す。 エラーの場合 \-1 を返す (また \fIerrno\fP が適切に設定される)。 .SH エラー .TP \fBEACCES\fP \fIpathname\fP の中のディレクトリの一つに対し検索(実行)許可がない。 .TP \fBEDQUOT\fP ディスクブロックか inode がそのファイルシステムのユーザークォータに達していた。 .TP \fBEEXIST\fP \fIpathname\fP がすでに存在する。 これには \fIpathname\fP がシンボリックリンクである場合も含まれる (シンボリックリンクがリンク切れか (dangling) どうかは関係ない)。 .TP \fBENAMETOOLONG\fP \fIpathname\fP の長さが \fBPATH_MAX\fP を超えているか、個々のファイル 名部分の長さが \fBNAME_MAX\fP を超えている。GNUシステムにおいては、ファ イル名の全体の長さに対しては制限は課せられていないが、ファイルシステム によっては各部分の長さに制限のある可能性がある。 .TP \fBENOENT\fP \fIpathname\fP 中のディレクトリ部分が存在しない、 もしくはリンク先の無いシンボリックリンクである。 .TP \fBENOSPC\fP ディレクトリまたはファイルシステムに新規ファイルを作成する余地がない。 .TP \fBENOTDIR\fP \fIpathname\fP 中のディレクトリ要素が、実際にはディレクトリでない。 .TP \fBEROFS\fP \fIpathname\fP が読み取り専用のファイルシステムを指している。 .PP \fBmkfifoat\fP() では以下のエラーも発生する。 .TP \fBEBADF\fP \fIdirfd\fP が有効なファイルディスクリプターでない。 .TP \fBENOTDIR\fP \fIpathname\fP が相対パスで、 \fIdirfd\fP がディレクトリ以外のファイルを参照しているファイルディスクリプターである。 .SH バージョン \fBmkfifoat\fP() は glibc 2.4 で追加された。これは、カーネル 2.6.16 以降の Linux で利用できる \fBmknodat\fP(2) を使って実装されている。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBmkfifo\fP() と \fBmkfifoat\fP() はスレッドセーフである。 .SH 準拠 \fBmkfifo\fP(): POSIX.1\-2001, POSIX.1\-2008. \fBmkfifoat\fP(): POSIX.1\-2008. .SH 関連項目 \fBmkfifo\fP(1), \fBclose\fP(2), \fBopen\fP(2), \fBread\fP(2), \fBstat\fP(2), \fBumask\fP(2), \fBwrite\fP(2), \fBfifo\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。