X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=draft%2Fman2%2Ftee.2;h=48ad1f430b1c81876a5d7c3bce6836e5fbd48756;hb=c1dfa2f6ab1bbed84992d3c59ee9925f4d453668;hp=eb56254c6313550831fe8453ca35ca37ec8da7e1;hpb=633a2252e0be3c867dce264a180a89ce8181d36f;p=linuxjm%2FLDP_man-pages.git diff --git a/draft/man2/tee.2 b/draft/man2/tee.2 index eb56254c..48ad1f43 100644 --- a/draft/man2/tee.2 +++ b/draft/man2/tee.2 @@ -1,8 +1,7 @@ -.\" Hey Emacs! This file is -*- nroff -*- source. -.\" .\" This manpage is Copyright (C) 2006 Jens Axboe .\" and Copyright (C) 2006 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. @@ -22,206 +21,72 @@ .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. +.\" %%%LICENSE_END +.\" +.\"******************************************************************* .\" -.\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI -.\" all rights reserved. -.\" Translated 2007-02-04, Akihiro MOTOKI -.\" -.TH TEE 2 2009-09-15 "Linux" "Linux Programmer's Manual" -.\"O .SH NAME -.SH ̾Á° -.\"O tee \- duplicating pipe content -tee \- ¥Ñ¥¤¥×¤ÎÃæ¿È¤òÊ£À½¤¹¤ë -.\"O .SH SYNOPSIS -.SH ½ñ¼° +.\" This file was generated with po4a. Translate the source file. +.\" +.\"******************************************************************* +.TH TEE 2 2012\-05\-04 Linux "Linux Programmer's Manual" +.SH 名前 +tee \- パイプの中身を複製する +.SH 書式 .nf -.B #define _GNU_SOURCE -.B #include +\fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */ +\fB#include \fP -.BI "ssize_t tee(int " fd_in ", int " fd_out ", size_t " len \ -", unsigned int " flags ); +\fBssize_t tee(int \fP\fIfd_in\fP\fB, int \fP\fIfd_out\fP\fB, size_t \fP\fIlen\fP\fB, unsigned int \fP\fIflags\fP\fB);\fP .fi .\" Return type was long before glibc 2.7 -.\"O .SH DESCRIPTION -.SH ÀâÌÀ +.SH 説明 .\" Example programs http://brick.kernel.dk/snaps .\" .\" .\" add a "tee(in, out1, out2)" system call that duplicates the pages .\" (again, incrementing their reference count, not copying the data) from .\" one pipe to two other pipes. -.\"O .BR tee () -.\"O duplicates up to -.\"O .I len -.\"O bytes of data from the pipe referred to by the file descriptor -.\"O .I fd_in -.\"O to the pipe referred to by the file descriptor -.\"O .IR fd_out . -.\"O It does not consume the data that is duplicated from -.\"O .IR fd_in ; -.\"O therefore, that data can be copied by a subsequent -.\"O .BR splice (2). -.BR tee () -¤Ï¡¢¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ -.I fd_in -¤¬»²¾È¤¹¤ë¥Ñ¥¤¥×¤«¤é¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ -.I fd_out -¤¬»²¾È¤¹¤ë¥Ñ¥¤¥×¤ØºÇÂç -.I len -¥Ð¥¤¥È¤Î¥Ç¡¼¥¿¤òÊ£À½¤¹¤ë¡£ -¤³¤ÎÁàºî¤Ç¤Ï¡¢Ê£À½¤µ¤ì¤ë¥Ç¡¼¥¿¤Ï -.I fd_in -¤«¤é¤Ï¾ÃÈñ¤µ¤ì¤Ê¤¤¡£¤·¤¿¤¬¤Ã¤Æ¡¢¤³¤ì¤é¤Î¥Ç¡¼¥¿¤ò¤³¤Î¸å¤Î -.BR splice (2) -¤Ç¥³¥Ô¡¼¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£ +\fBtee\fP() は、ファイルディスクリプタ \fIfd_in\fP が参照するパイプからファイルディスクリプタ \fIfd_out\fP が参照するパイプへ最大 +\fIlen\fP バイトのデータを複製する。 この操作では、複製されるデータは \fIfd_in\fP からは消費されない。したがって、これらのデータをこの後の +\fBsplice\fP(2) でコピーすることができる。 -.\"O .I flags -.\"O is a series of modifier flags, which share the name space with -.\"O .BR splice (2) -.\"O and -.\"O .BR vmsplice (2): -.I flags -¤Ï°ìÏ¢¤Î½¤¾þ¥Õ¥é¥°¤Ç¤¢¤ê¡¢ -.BR splice (2) -¤ä -.BR vmsplice (2) -¤È¶¦Ä̤Î̾Á°¤Ç¤¢¤ë¡£ -.TP 1.9i -.B SPLICE_F_MOVE -.\"O Currently has no effect for -.\"O .BR tee (); -.\"O see -.\"O .BR splice (2). -¸½ºß¤Î¤È¤³¤í -.BR tee () -¤Ç¤Ï²¿¤Î¸ú²Ì¤â¤Ê¤¤¡£ -.BR splice (2) -»²¾È¡£ -.TP -.B SPLICE_F_NONBLOCK -.\"O Do not block on I/O; see -.\"O .BR splice (2) -.\"O for further details. -Æþ½ÐÎÏ»þ¤ËÄä»ß (block) ¤·¤Ê¤¤¡£ -¾ÜºÙ¤Ï -.BR splice (2) -»²¾È¡£ -.TP -.B SPLICE_F_MORE -.\"O Currently has no effect for -.\"O .BR tee (), -.\"O but may be implemented in the future; see -.\"O .BR splice (2). -¸½ºß¤Î¤È¤³¤í -.BR tee () -¤Ç¤Ï²¿¤Î¸ú²Ì¤â¤Ê¤¤¤¬¡¢¾­ÍèŪ¤Ë¤Ï¼ÂÁõ¤µ¤ì¤ë²ÄǽÀ­¤¬¤¢¤ë¡£ -.BR splice (2) -»²¾È¡£ -.TP -.B SPLICE_F_GIFT -.\"O Unused for -.\"O .BR tee (); -.\"O see -.\"O .BR vmsplice (2). -.BR tee () -¤Ç¤Ï̤»ÈÍÑ¡£ -.BR vmsplice (2) -»²¾È¡£ -.\"O .SH RETURN VALUE -.SH ÊÖ¤êÃÍ -.\"O Upon successful completion, -.\"O .BR tee () -.\"O returns the number of bytes that were duplicated between the input -.\"O and output. -.\"O A return value of 0 means that there was no data to transfer, -.\"O and it would not make sense to block, because there are no -.\"O writers connected to the write end of the pipe referred to by -.\"O .IR fd_in . -À®¸ù¤·¤Æ´°Î»¤¹¤ë¤È¡¢ -.BR tee () -¤ÏÆþ½ÐÎÏ´Ö¤ÇÊ£À½¤µ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£ -ÊÖ¤êÃÍ 0 ¤Ï¥Ç¡¼¥¿¤ÎžÁ÷¤¬¹Ô¤ï¤ì¤Ê¤«¤Ã¤¿¤³¤È¤ò¼¨¤¹¡£ -¤³¤Î¾ì¹ç¡¢½èÍý¤òÄä»ß (block) ¤·¤Æ¤â̵°ÕÌ£¤Ç¤¢¤ë¡£ -¤Ê¤¼¤Ê¤é¡¢ -.I fd_in -¤¬»²¾È¤¹¤ë¥Ñ¥¤¥×¤Î½ñ¤­¹þ¤ß¦¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë¼Ô¤¬¤¤¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£ +\fIflags\fP は一連の修飾フラグであり、 \fBsplice\fP(2) や \fBvmsplice\fP(2) と共通の名前である。 +.TP 1.9i +\fBSPLICE_F_MOVE\fP +現在のところ \fBtee\fP() では何の効果もない。 \fBsplice\fP(2) 参照。 +.TP +\fBSPLICE_F_NONBLOCK\fP +入出力で停止 (block) しない。詳細は \fBsplice\fP(2) 参照。 +.TP +\fBSPLICE_F_MORE\fP +現在のところ \fBtee\fP() では何の効果もないが、将来的には実装される可能性がある。 \fBsplice\fP(2) 参照。 +.TP +\fBSPLICE_F_GIFT\fP +\fBtee\fP() では未使用。 \fBvmsplice\fP(2) 参照。 +.SH 返り値 +成功して完了すると、 \fBtee\fP() は入出力間で複製されたバイト数を返す。 返り値 0 はデータの転送が行われなかったことを示す。 +この場合、処理を停止 (block) しても無意味である。 なぜなら、 \fIfd_in\fP +が参照するパイプの書き込み側に接続されている者がいないからである。 -.\"O On error, -.\"O .BR tee () -.\"O returns \-1 and -.\"O .I errno -.\"O is set to indicate the error. -¥¨¥é¡¼¤Î¾ì¹ç¡¢ -.BR tee () -¤Ï \-1 ¤òÊÖ¤·¡¢ -.I errno -¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£ -.\"O .SH ERRORS -.SH ¥¨¥é¡¼ -.TP -.B EINVAL -.\"O .I fd_in -.\"O or -.\"O .I fd_out -.\"O does not refer to a pipe; or -.\"O .I fd_in -.\"O and -.\"O .I fd_out -.\"O refer to the same pipe. -.I fd_in -¤È -.I fd_out -¤Î¤É¤Á¤é¤«¤¬¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤Ê¤¤¡£¤â¤·¤¯¤Ï -.I fd_in -¤È -.I fd_out -¤¬Æ±¤¸¥Ñ¥¤¥×¤ò»²¾È¤·¤Æ¤¤¤ë¡£ -.TP -.B ENOMEM -.\"O Out of memory. -¥á¥â¥êÉÔ­¡£ -.\"O .SH VERSIONS -.SH ¥Ð¡¼¥¸¥ç¥ó -.\"O The -.\"O .BR tee () -.\"O system call first appeared in Linux 2.6.17. -.BR tee () -¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.6.17 ¤Ç½é¤á¤ÆÅо줷¤¿¡£ -.\"O .SH "CONFORMING TO" -.SH ½àµò -.\"O This system call is Linux-specific. -¤³¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux ¸ÇÍ­¤Ç¤¢¤ë¡£ -.\"O .SH NOTES -.SH Ãí°Õ -.\"O Conceptually, -.\"O .BR tee () -.\"O copies the data between the two pipes. -.\"O In reality no real data copying takes place though: -.\"O under the covers, -.\"O .BR tee () -.\"O assigns data in the output by merely grabbing -.\"O a reference to the input. -³µÇ°¤È¤·¤Æ¤Ï¡¢ -.BR tee () -¤ÏÆó¤Ä¤Î¥Ñ¥¤¥×´Ö¤Ç¥Ç¡¼¥¿¤Î¥³¥Ô¡¼¤ò¹Ô¤¦¡£ -¤·¤«¤·¡¢¼ÂºÝ¤Ë¤Ï¼Â¥Ç¡¼¥¿¤Î¥³¥Ô¡¼¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£ -ÆâÉô¤Ç¤Ï¡¢ -.BR tee () -¤ÏÆþÎϦ¤ËÂФ¹¤ë»²¾È¤À¤±¤òºîÀ®¤¹¤ë¤³¤È¤Ç½ÐÎϦ¤Ë¥Ç¡¼¥¿¤ò -Äɲ乤롣 -.\"O .SH EXAMPLE -.SH Îã -.\"O The following example implements a basic -.\"O .BR tee (1) -.\"O program using the -.\"O .BR tee () -.\"O system call. -°Ê²¼¤ÎÎã¤Ï¡¢ -.BR tee () -¥·¥¹¥Æ¥à¥³¡¼¥ë¤ò»È¤Ã¤Æ¡¢ -´ðËÜŪ¤Ê -.BR tee (1) -¥×¥í¥°¥é¥à¤ò¼ÂÁõ¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£ +エラーの場合、 \fBtee\fP() は \-1 を返し、 \fIerrno\fP にエラーを示す値を設定する。 +.SH エラー +.TP +\fBEINVAL\fP +\fIfd_in\fP と \fIfd_out\fP のどちらかがパイプを参照していない。もしくは \fIfd_in\fP と \fIfd_out\fP +が同じパイプを参照している。 +.TP +\fBENOMEM\fP +メモリ不足。 +.SH バージョン +\fBtee\fP() システムコールは Linux 2.6.17 で初めて登場した。 +ライブラリによるサポートは glibc バージョン 2.5 で追加された。 +.SH 準拠 +このシステムコールは Linux 固有である。 +.SH 注意 +概念としては、 \fBtee\fP() は二つのパイプ間でデータのコピーを行う。 しかし、実際には実データのコピーは行われない。 内部では、 +\fBtee\fP() は入力側に対する参照だけを作成することで出力側にデータを 追加する。 +.SH 例 +以下の例は、 \fBtee\fP() システムコールを使って、 基本的な \fBtee\fP(1) プログラムを実装したものである。 .nf #define _GNU_SOURCE @@ -239,8 +104,8 @@ main(int argc, char *argv[]) int len, slen; if (argc != 2) { - fprintf(stderr, "Usage: %s \\n", argv[0]); - exit(EXIT_FAILURE); + fprintf(stderr, "Usage: %s \en", argv[0]); + exit(EXIT_FAILURE); } fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -283,8 +148,9 @@ main(int argc, char *argv[]) exit(EXIT_SUCCESS); } .fi -.\"O .SH SEE ALSO -.SH ´ØÏ¢¹àÌÜ -.BR splice (2), -.BR vmsplice (2), -.BR feature_test_macros (7) +.SH 関連項目 +\fBsplice\fP(2), \fBvmsplice\fP(2) +.SH この文書について +この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部 +である。プロジェクトの説明とバグ報告に関する情報は +http://www.kernel.org/doc/man\-pages/ に書かれている。