OSDN Git Service

Retire LDP man-pages repository
[linuxjm/LDP_man-pages.git] / draft / man2 / pipe.2
diff --git a/draft/man2/pipe.2 b/draft/man2/pipe.2
deleted file mode 100644 (file)
index fa863a8..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-.\" Copyright (C) 2005, 2008, Michael Kerrisk <mtk.manpages@gmail.com>
-.\" (A few fragments remain from an earlier (1992) version by
-.\" Drew Eckhardt <drew@cs.colorado.edu>.)
-.\"
-.\" %%%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
-.\"
-.\" Modified by Michael Haardt <michael@moria.de>
-.\" Modified 1993-07-23 by Rik Faith <faith@cs.unc.edu>
-.\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
-.\" Modified 2005, mtk: added an example program
-.\" Modified 2008-01-09, mtk: rewrote DESCRIPTION; minor additions
-.\"     to EXAMPLE text.
-.\" 2008-10-10, mtk: add description of pipe2()
-.\"
-.\"*******************************************************************
-.\"
-.\" This file was generated with po4a. Translate the source file.
-.\"
-.\"*******************************************************************
-.\"
-.\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
-.\"         all rights reserved.
-.\" Translated Thu Jun 26 21:09:51 JST 1997
-.\"         by SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
-.\" Updated & Modified Thu Feb 10 00:47:11 JST 2005
-.\"         by Yuichi SATO <ysato444@yahoo.co.jp>
-.\" Updated & Modified Sat Dec 17 08:10:16 JST 2005 by Yuichi SATO
-.\" Updated 2008-02-10, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.77
-.\" Updated 2008-11-09, Akihiro MOTOKI, LDP v3.13
-.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
-.\"
-.TH PIPE 2 2014\-07\-08 Linux "Linux Programmer's Manual"
-.SH 名前
-pipe, pipe2 \- パイプを生成する
-.SH 書式
-.nf
-\fB#include <unistd.h>\fP
-.sp
-\fBint pipe(int \fP\fIpipefd\fP\fB[2]);\fP
-.sp
-\fB#define _GNU_SOURCE\fP             /* feature_test_macros(7) 参照 */
-\fB#include <fcntl.h>\fP              /* O_* 定数の定義の取得 */
-\fB#include <unistd.h>\fP
-.sp
-\fBint pipe2(int \fP\fIpipefd\fP\fB[2], int \fP\fIflags\fP\fB);\fP
-.fi
-.SH 説明
-\fBpipe\fP()  はパイプを生成する。 パイプは、プロセス間通信に使用できる単方向のデータチャネルである。 配列 \fIpipefd\fP
-は、パイプの両端を参照する二つのファイルディスクリプターを 返すのに使用される。 \fIpipefd[0]\fP がパイプの読み出し側、
-\fIpipefd[1]\fP がパイプの書き込み側である。 パイプの書き込み側に書き込まれたデータは、
-パイプの読み出し側から読み出されるまでカーネルでバッファーリングされる。 さらなる詳細は \fBpipe\fP(7)  を参照のこと。
-
-\fBpipe2\fP()  は \fIflags\fP が 0 の場合には \fBpipe\fP()  と同じである。 \fIflags\fP に以下の値をビット毎の論理和
-(OR) で指定することで、 異なる動作をさせることができる。
-.TP 
-\fBO_CLOEXEC\fP
-新しく生成される二つのファイルディスクリプターの close\-on\-exec (\fBFD_CLOEXEC\fP)  フラグをセットする。
-このフラグが役に立つ理由については、 \fBopen\fP(2)  の \fBO_CLOEXEC\fP フラグの説明を参照のこと。
-.TP 
-\fBO_DIRECT\fP (Linux 3.4 以降)
-.\" commit 9883035ae7edef3ec62ad215611cb8e17d6a1a5d
-「パケット」モードで入出力を行うパイプを作成する。 このパイプへの \fBwrite\fP(2) それぞれが別のパケットとして扱われ、 このパイプからの
-\fBread\fP(2) では一度に一つパケットが読み出される。 以下の点に注意すること。
-.RS
-.IP * 3
-\fBPIPE_BUF\fP バイト (\fBpipe\fP(7) 参照) より大きいデータを書き込んだ場合、複数のパケットに分割される。
-定数 \fBPIPE_BUF\fP は \fI<limits.h>\fP で定義されている。
-.IP *
-\fBread\fP(2)
-で次のパケットよりも小さなバッファーサイズを指定した場合、要求されたバイト数のデータが読み出され、そのパケットの超過分のバイトは破棄される。
-可能性のある最大サイズのパケットを読み出すには、\fBPIPE_BUF\fP のバッファーサイズを指定すれば十分である (上の項目を参照)。
-.IP *
-長さ 0 のパケットはサポートされていない。 (バッファーサイズ 0 を指定した \fBread\fP(2) は何も行わず 0 を返す)。
-.RE
-.IP
-このフラグをサポートしていない古いカーネルでは、エラー \fBEINVAL\fP が返る。これによりカーネルがサポートしていないことが分かる。
-.TP 
-\fBO_NONBLOCK\fP
-新しく生成される二つのオープンファイル記述 (open file description) の \fBO_NONBLOCK\fP
-ファイルステータスフラグをセットする。 このフラグを使うことで、 \fBO_NONBLOCK\fP をセットするために \fBfcntl\fP(2)
-を追加で呼び出す必要がなくなる。
-.SH 返り値
-成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
-.SH エラー
-.TP 
-\fBEFAULT\fP
-\fIpipefd\fP が無効な値である。
-.TP 
-\fBEINVAL\fP
-(\fBpipe2\fP())  \fIflags\fP に無効な値が入っている。
-.TP 
-\fBEMFILE\fP
-このプロセスで使われているファイルディスクリプターが多すぎる。
-.TP 
-\fBENFILE\fP
-オープンされているファイルの総数がシステムの制限に達している。
-.SH バージョン
-\fBpipe2\fP()  はバージョン 2.6.27 で Linux に追加された。 glibc によるサポートはバージョン 2.9 以降で利用できる。
-.SH 準拠
-\fBpipe\fP(): POSIX.1\-2001.
-
-\fBpipe2\fP()  は Linux 固有である。
-.SH 例
-.\" fork.2 refers to this example program.
-以下のプログラムではパイプを生成し、その後 \fBfork\fP(2)  で子プロセスを生成する。
-子プロセスは同じパイプを参照するファイルディスクリプター集合のコピーを 継承する。 \fBfork\fP(2)  の後、各プロセスはパイプ
-(\fBpipe\fP(7)  を参照) に必要がなくなったディスクリプターをクローズする。 親プロセスはプログラムのコマンドライン引き数に含まれる
-文字列をパイプへ書き込み、 子プロセスはこの文字列をパイプから 1 バイトずつ読み込んで標準出力にエコーする。
-.SS プログラムのソース
-.nf
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-int
-main(int argc, char *argv[])
-{
-    int pipefd[2];
-    pid_t cpid;
-    char buf;
-
-    if (argc != 2) {
-        fprintf(stderr, "Usage: %s <string>\en", argv[0]);
-        exit(EXIT_FAILURE);
-    }
-
-    if (pipe(pipefd) == \-1) {
-        perror("pipe");
-        exit(EXIT_FAILURE);
-    }
-
-    cpid = fork();
-    if (cpid == \-1) {
-        perror("fork");
-        exit(EXIT_FAILURE);
-    }
-
-    if (cpid == 0) {    /* 子プロセスがパイプから読み込む */
-        close(pipefd[1]);  /* 使用しない write 側はクローズする */
-
-        while (read(pipefd[0], &buf, 1) > 0)
-            write(STDOUT_FILENO, &buf, 1);
-
-        write(STDOUT_FILENO, "\en", 1);
-        close(pipefd[0]);
-        _exit(EXIT_SUCCESS);
-
-    } else {            /* 親プロセスは argv[1] をパイプへ書き込む */
-        close(pipefd[0]);          /* 使用しない read 側はクローズする */
-        write(pipefd[1], argv[1], strlen(argv[1]));
-        close(pipefd[1]);          /* 読み込み側が EOF に出会う */
-        wait(NULL);                /* 子プロセスを待つ */
-        exit(EXIT_SUCCESS);
-    }
-}
-.fi
-.SH 関連項目
-\fBfork\fP(2), \fBread\fP(2), \fBsocketpair\fP(2), \fBwrite\fP(2), \fBpopen\fP(3),
-\fBpipe\fP(7)
-.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
-である。プロジェクトの説明とバグ報告に関する情報は
-http://www.kernel.org/doc/man\-pages/ に書かれている。