OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / sendfile.2
index dea3c30..7cb62b3 100644 (file)
 .\" Updated 2005-04-17, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\" Updated 2010-04-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
 .\"
-.\"WORD:       descriptor              ¥Ç¥£¥¹¥¯¥ê¥×¥¿
-.\"WORD:       socket                  ¥½¥±¥Ã¥È
-.\"WORD:       lock                    ¥í¥Ã¥¯
+.\"WORD:       descriptor              ã\83\87ã\82£ã\82¹ã\82¯ã\83ªã\83\97ã\82¿
+.\"WORD:       socket                  ソケット
+.\"WORD:       lock                    ã\83­ã\83\83ã\82¯
 .\"
 .TH SENDFILE 2 2010-02-15 "Linux" "Linux Programmer's Manual"
-.SH Ì¾Á°
-sendfile \- ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿´Ö¤Ç¥Ç¡¼¥¿¤òžÁ÷¤¹¤ë
-.SH ½ñ¼°
+.SH 名前
+sendfile \- ファイル・ディスクリプタ間でデータを転送する
+.SH 書式
 .B #include <sys/sendfile.h>
 .sp
 .BI "ssize_t sendfile(int" " out_fd" ", int" " in_fd" ", off_t *" \
                       offset ", size_t" " count" );
 .\"O .\" The below is too ugly. Comments about glibc versions belong
 .\"O .\" in the notes, not in the header.
-.\" °Ê²¼¤Ï¡¢¤¢¤Þ¤ê¤Ë¤â±ø¤¤¡£ glibc ¥Ð¡¼¥¸¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Î¥³¥á¥ó¥È¤Ï
-.\" ¡Ö¥Ø¥Ã¥À¡×¤Ç¤Ï¤Ê¤¯¡¢¡ÖÃí°Õ¡×¤Ë½ñ¤¤¤Æ¤ª¤¯¡£
+.\" 以下は、あまりにも汚い。 glibc バージョンについてのコメントは
+.\" 「ヘッダ」ではなく、「注意」に書いておく。
 .\"
 .\" .B #include <features.h>
 .\" .br
@@ -55,7 +55,7 @@ sendfile \- 
 .\" .br
 .\" .B #endif
 .\"
-.SH ÀâÌÀ
+.SH 説明
 .\"O .BR sendfile ()
 .\"O copies data between one file descriptor and another.
 .\"O Because this copying is done within the kernel,
@@ -66,28 +66,28 @@ sendfile \- 
 .\"O .BR write (2),
 .\"O which would require transferring data to and from user space.
 .BR sendfile ()
-¤Ï¡¢¤¢¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤«¤éÊ̤Î
-¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ø¤Î¥Ç¡¼¥¿¤Î¥³¥Ô¡¼¤ò¹Ô¤¦¡£
-¤³¤Î¥³¥Ô¡¼¤Ï¥«¡¼¥Í¥ëÆâ¤Ç¹Ô¤ï¤ì¤ë¤Î¤Ç¡¢
+は、あるファイル・ディスクリプタから別の
+ファイル・ディスクリプタへのデータのコピーを行う。
+このコピーはカーネル内で行われるので、
 .BR sendfile ()
-¤Ï¡¢
+は、
 .BR read (2)
-¤È
+と
 .BR write (2)
-¤òÁȤ߹ç¤ï¤»¤ë¤è¤ê¤â¸úΨ¤¬¤è¤¤¡£
+を組み合わせるよりも効率がよい。
 .BR read (2)
-¤ä
+や
 .BR write (2)
-¤Ç¤Ï¥æ¡¼¥¶¶õ´Ö¤È¤Î´Ö¤Ç¥Ç¡¼¥¿¤ÎžÁ÷¤¬É¬ÍפȤʤ뤫¤é¤Ç¤¢¤ë¡£
+ではユーザ空間との間でデータの転送が必要となるからである。
 
 .\"O .I in_fd
 .\"O should be a file descriptor opened for reading and
 .\"O .I out_fd
 .\"O should be a descriptor opened for writing.
 .I in_fd
-¤ÏÆɤ߹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¡¢
+は読み込みのためにオープンされたファイル・ディスクリプタ、
 .I out_fd
-¤Ï½ñ¤­¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+は書き込みのためにオープンされたディスクリプタでなければならない。
 
 .\"O If
 .\"O .I offset
@@ -101,17 +101,17 @@ sendfile \- 
 .\"O returns, this variable
 .\"O will be set to the offset of the byte following the last byte that was read.
 .I offset
-¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢
+が NULL でない場合、
 .I offset
-¤Ï
+は
 .BR sendfile ()
-¤¬
+が
 .I in_fd
-¤Î¤É¤³¤«¤é¥Ç¡¼¥¿¤òÆɤ߻Ϥá¤ë¤«¤ò¼¨¤¹¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤òÊÝ»ý¤¹¤ëÊÑ¿ô¤Ø¤Î
-¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
+のどこからデータを読み始めるかを示すファイル・オフセットを保持する変数への
+ポインタである。
 .BR sendfile ()
-¤ÏÉüµ¢¤¹¤ë»þ¡¢¤³¤ÎÊÑ¿ô¤ËºÇ¸å¤ËÆɤ߹þ¤ó¤À¥Ð¥¤¥È¤Î
-¼¡¤Î¥Ð¥¤¥È¤Î¥ª¥Õ¥»¥Ã¥È¤ò½ñ¤­¹þ¤à¡£
+は復帰する時、この変数に最後に読み込んだバイトの
+次のバイトのオフセットを書き込む。
 .\"O If
 .\"O .I offset
 .\"O is not NULL, then
@@ -122,14 +122,14 @@ sendfile \- 
 .\"O the number of bytes read from
 .\"O .IR in_fd .
 .I offset
-¤¬ NULL ¤Ç¤Ê¤¤¾ì¹ç¡¢
+が NULL でない場合、
 .BR sendfile ()
-¤Ï
+は
 .I in_fd
-¤Î¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤Î¸½ºßÃͤòÊѹ¹¤·¤Ê¤¤¡£
-NULL ¤Î¾ì¹ç¤Ï¡¢¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤Î¸½ºßÃͤò
+のファイル・オフセットの現在値を変更しない。
+NULL の場合は、ファイル・オフセットの現在値を
 .I in_fd
-¤«¤éÆɤ߹þ¤ó¤À¥Ð¥¤¥È¿ô¤òÈ¿±Ç¤·¤¿°ÌÃÖ¤ËÄ´À°¤¹¤ë¡£
+から読み込んだバイト数を反映した位置に調整する。
 
 .\"O If
 .\"O .I offset
@@ -138,15 +138,15 @@ NULL 
 .\"O starting at the current file offset,
 .\"O and the file offset will be updated by the call.
 .I offset
-¤¬ NULL ¤Î¾ì¹ç¡¢¥Ç¡¼¥¿¤Ï
+が NULL の場合、データは
 .I in_fd
-¤Î¸½ºß¤Î¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤«¤éÆɤ߽Фµ¤ì¡¢
-¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤Ï¤³¤Î¸Æ¤Ó½Ð¤·¤Ç¹¹¿·¤µ¤ì¤ë¡£
+の現在のファイル・オフセットから読み出され、
+ファイル・オフセットはこの呼び出しで更新される。
 
 .\"O .I count
 .\"O is the number of bytes to copy between the file descriptors.
 .I count
-¤Ï¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿´Ö¤Ç¥³¥Ô¡¼¤¹¤ë¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
+は、ファイル・ディスクリプタ間でコピーするバイト数である。
 
 .\"O Presently (Linux 2.6.9):
 .\"O .IR in_fd ,
@@ -157,14 +157,14 @@ NULL 
 .\"O and
 .\"O .I out_fd
 .\"O must refer to a socket.
-º£¤Î¤È¤³¤í (Linux 2.6.9 ¤Ç¤Ï)¡¢
+今のところ (Linux 2.6.9 では)、
 .I in_fd
-¤Ï
+は
 .BR mmap (2)
-É÷¤ÎÁàºî¤¬¤Ç¤­¤ë¥Õ¥¡¥¤¥ë¤ò»Ø¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤
-(¥½¥±¥Ã¥È¤ò»Ø¤·¤Æ¤Ï¤Ê¤é¤Ê¤¤)¡£¤Þ¤¿¡¢
+風の操作ができるファイルを指していなければならない
+(ソケットを指してはならない)。また、
 .I out_fd
-¤Ï¥½¥±¥Ã¥È¤ò»Ø¤·¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
+はソケットを指していなければならない。
 
 .\"O Applications may wish to fall back to
 .\"O .BR read (2)/ write (2)
@@ -175,95 +175,95 @@ NULL 
 .\"O or
 .\"O .BR ENOSYS .
 .BR sendfile ()
-¤¬
+が
 .B EINVAL
-¤ä
+や
 .B ENOSYS
-¤Ç¼ºÇÔ¤¹¤ë¤è¤¦¤Ê¾ì¹ç¤Ï¡¢
-¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï
+で失敗するような場合は、
+アプリケーションは
 .BR read (2)/ write (2)
-¤ËÌ᤹¤³¤È¤ò¹Í¤¨¤Æ¤â¤è¤¤¤«¤â¤·¤ì¤Ê¤¤¡£
+に戻すことを考えてもよいかもしれない。
 .\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
+.SH 返り値
 .\"O If the transfer was successful, the number of bytes written to
 .\"O .I out_fd
 .\"O is returned.
 .\"O On error, \-1 is returned, and
 .\"O .I errno
 .\"O is set appropriately.
-žÁ÷¤ËÀ®¸ù¤·¤¿¾ì¹ç¡¢
+転送に成功した場合、
 .I out_fd
-¤Ë½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
+に書き込まれたバイト数を返す。エラーの場合、\-1 を返し、
 .I errno
-¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£
+に適切な値を設定する。
 .\"O .SH ERRORS
-.SH ¥¨¥é¡¼
+.SH ã\82¨ã\83©ã\83¼
 .TP
 .B EAGAIN
 .\"O Nonblocking I/O has been selected using
 .\"O .B O_NONBLOCK
 .\"O and the write would block.
 .B O_NONBLOCK
-¤òÍѤ¤¤ÆÈó¥Ö¥í¥Ã¥¯ I/O ¤¬ÁªÂò¤µ¤ì¤¿¤¬¡¢½ñ¤­¹þ¤ß¤¬¥Ö¥í¥Ã¥¯¤µ¤ì¤¿¡£
+を用いて非ブロック I/O が選択されたが、書き込みがブロックされた。
 .TP
 .B EBADF
 .\"O The input file was not opened for reading or the output file
 .\"O was not opened for writing.
-ÆþÎÏ¥Õ¥¡¥¤¥ë¤¬Æɤ߹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¤«¡¢
-½ÐÎÏ¥Õ¥¡¥¤¥ë¤¬½ñ¤­¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
+入力ファイルが読み込みのためにオープンされていないか、
+出力ファイルが書き込みのためにオープンされていない。
 .TP
 .B EFAULT
 .\"O Bad address.
-¥¢¥É¥ì¥¹¤¬¤ª¤«¤·¤¤¡£
+アドレスがおかしい。
 .TP
 .B EINVAL
 .\"O Descriptor is not valid or locked, or an
 .\"O .BR mmap (2)-like
 .\"O operation is not available for
 .\"O .IR in_fd .
-¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬Í­¸ú¤Ç¤Ê¤¤¤«¡¢¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤ë¡£¤â¤·¤¯¤Ï
+ディスクリプタが有効でないか、ロックされている。もしくは
 .BR mmap (2)
-É÷¤ÎÁàºî¤¬
+風の操作が
 .I in_fd
-¤Ç¤ÏÍøÍѤǤ­¤Ê¤¤¡£
+では利用できない。
 .TP
 .B EIO
 .\"O Unspecified error while reading from
 .\"O .IR in_fd .
 .I in_fd
-¤«¤éÆɤ߹þ¤ó¤Ç¤¤¤ë¤¦¤Á¤Ëͽ´ü¤·¤Ê¤¤¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£
+から読み込んでいるうちに予期しないエラーが起こった。
 .TP
 .B ENOMEM
 .\"O Insufficient memory to read from
 .\"O .IR in_fd .
 .I in_fd
-¤«¤éÆɤ߹þ¤à¤¿¤á¤Î½½Ê¬¤Ê¥á¥â¥ê¤¬¤Ê¤¤¡£
+から読み込むための十分なメモリがない。
 .\"O .SH VERSIONS
-.SH ¥Ð¡¼¥¸¥ç¥ó
+.SH バージョン
 .\"O .B sendfile
 .\"O is a new feature in Linux 2.2.
 .B sendfile
-¤Ï Linux 2.2 ¤Î¿·¤·¤¤µ¡Ç½¤Ç¤¢¤ë¡£
+は Linux 2.2 の新しい機能である。
 .\"O The include file
 .\"O .I <sys/sendfile.h>
 .\"O is present since glibc 2.1.
-¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë
+インクルードファイル
 .I <sys/sendfile.h>
-¤Ï glibc 2.1 ¤«¤é¸ºß¤·¤Æ¤¤¤ë¡£
+は glibc 2.1 から存在している。
 .\"O .SH "CONFORMING TO"
-.SH ½àµò
+.SH 準拠
 .\"O Not specified in POSIX.1-2001, or other standards.
-POSIX.1-2001 ¤ä¾¤Îɸ½à¤Ç¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
+POSIX.1-2001 や他の標準では規定されていない。
 
 .\"O Other UNIX systems implement
 .\"O .BR sendfile ()
 .\"O with different semantics and prototypes.
 .\"O It should not be used in portable programs.
-¾¤Î UNIX ¥·¥¹¥Æ¥à¤Ç¤Ï¡¢°Û¤Ê¤Ã¤¿Êý¼°¤ä¥×¥í¥È¥¿¥¤¥×¤Ç
+他の UNIX システムでは、異なった方式やプロトタイプで
 .BR sendfile ()
-¤ò¼ÂÁõ¤·¤Æ¤¤¤ë¡£°Ü¿¢À­¤ò¹Íθ¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï»ÈÍѤ¹¤Ù¤­¤Ç¤Ï¤Ê¤¤¡£
+を実装している。移植性を考慮したプログラムでは使用すべきではない。
 .\"O .SH NOTES
-.SH Ãí°Õ
+.SH 注意
 .\"O If you plan to use
 .\"O .BR sendfile ()
 .\"O for sending files to a TCP socket, but need
@@ -274,26 +274,26 @@ POSIX.1-2001 
 .\"O .BR tcp (7),
 .\"O to minimize the number of packets and to tune performance.
 .BR sendfile ()
-¤ò»È¤Ã¤Æ TCP ¥½¥±¥Ã¥È¤Ë¥Õ¥¡¥¤¥ë¤òÁ÷¤í¤¦¤È¤·¤Æ¤¤¤Æ¡¢
-¥Õ¥¡¥¤¥ë¤ÎÆâÍƤÎÁ°¤Ë¥Ø¥Ã¥À¡¦¥Ç¡¼¥¿¤òÉÕ¤±²Ã¤¨¤ëɬÍפ¬¤¢¤ë¾ì¹ç¤Ï¡¢
-¥Ñ¥±¥Ã¥È¿ô¤òºÇ¾®¤Ë¤·¤ÆÀ­Ç½¤ò¾å¤²¤ë¤¿¤á¤Ë
+を使って TCP ソケットにファイルを送ろうとしていて、
+ファイルの内容の前にヘッダ・データを付け加える必要がある場合は、
+パケット数を最小にして性能を上げるために
 .BR tcp (7)
-¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë
+に記述されている
 .B TCP_CORK
-¥ª¥×¥·¥ç¥ó¤ò»È¤¦¤È¤¤¤¤¤À¤í¤¦¡£
+オプションを使うといいだろう。
 
 .\"O In Linux 2.4 and earlier,
 .\"O .I out_fd
 .\"O could refer to a regular file, and
 .\"O .BR sendfile ()
 .\"O changed the current offset of that file.
-Linux 2.4 ¤È¤½¤ì°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ç¤Ï¡¢
+Linux 2.4 とそれ以前のバージョンでは、
 .I out_fd
-¤ÏÄ̾ï¤Î¥Õ¥¡¥¤¥ë¤ò»²¾È¤Ç¤­¡¢
+は通常のファイルを参照でき、
 .BR sendfile ()
-¤Ï¤½¤Î¥Õ¥¡¥¤¥ë¤Î¥ª¥Õ¥»¥Ã¥È¤Î¸½ºßÃͤòÊѹ¹¤·¤Æ¤¤¤¿¡£
+はそのファイルのオフセットの現在値を変更していた。
 .\"O .SH SEE ALSO
-.SH ´ØÏ¢¹àÌÜ
+.SH 関連項目
 .BR mmap (2),
 .BR open (2),
 .BR socket (2),