OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man2 / pread.2
index 71c5d31..3293397 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 1999 Joseph Samuel Myers.
 .\"
+.\" %%%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.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
 .\"
 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
 .\"         all rights reserved.
 .\" Translated Fri Jun 25 23:32:20 JST 1999
 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
+.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2012-05-29, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-05-01, Akihiro MOTOKI <amotoki@gmail.com>
+.\" Updated 2013-07-24, Akihiro MOTOKI <amotoki@gmail.com>
 .\"
-.\"WORD:       descriptor              ディスクリプタ
-.\"WORD:       offset                  オフセット
-.\"WORD:       seek                    シーク
-.\"
-.TH PREAD 2 2010-09-26 "Linux" "Linux Programmer's Manual"
+.TH PREAD 2 2013\-06\-21 Linux "Linux Programmer's Manual"
 .SH 名前
-.\"O pread, pwrite \- read from or write to a file descriptor at a given offset
-pread, pwrite \- 指定したオフセットでファイルディスクリプタを読み書きする
+pread, pwrite \- 指定したオフセットでファイルディスクリプターを読み書きする
 .SH 書式
-.B #include <unistd.h>
+\fB#include <unistd.h>\fP
 .sp
-.BI "ssize_t pread(int " fd ", void *" buf ", size_t " count \
-", off_t " offset );
+\fBssize_t pread(int \fP\fIfd\fP\fB, void *\fP\fIbuf\fP\fB, size_t \fP\fIcount\fP\fB, off_t
+\fP\fIoffset\fP\fB);\fP
 .sp
-.BI "ssize_t pwrite(int " fd ", const void *" buf ", size_t " count \
-", off_t " offset );
+\fBssize_t pwrite(int \fP\fIfd\fP\fB, const void *\fP\fIbuf\fP\fB, size_t \fP\fIcount\fP\fB,
+off_t \fP\fIoffset\fP\fB);\fP
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc 向けの機能検査マクロの要件
-.RB ( feature_test_macros (7)
-参照):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .PD 0
 .ad l
 .sp
-.BR pread (),
-.BR pwrite ():
+\fBpread\fP(), \fBpwrite\fP():
 .RS 4
 _XOPEN_SOURCE\ >=\ 500
 .br
-.\"O || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
 || /* glibc 2.12 以降: */ _POSIX_C_SOURCE\ >=\ 200809L
 .RE
 .ad
 .PD
-.\"O .SH DESCRIPTION
 .SH 説明
-.\"O .BR pread ()
-.\"O reads up to
-.\"O .I count
-.\"O bytes from file descriptor
-.\"O .I fd
-.\"O at offset
-.\"O .I offset
-.\"O (from the start of the file) into the buffer starting at
-.\"O .IR buf .
-.\"O The file offset is not changed.
-.BR pread ()
-は、ファイルディスクリプタ
-.I fd
-の (ファイルの先頭からの) オフセット
-.I offset
-から最大
-.I count
-バイトをバッファ
-.I buf
-へ読み込む。ファイル・オフセットは変化しない。
+\fBpread\fP()  は、ファイルディスクリプター \fIfd\fP の (ファイルの先頭からの) オフセット \fIoffset\fP から最大
+\fIcount\fP バイトをバッファー \fIbuf\fP へ読み込む。ファイルオフセットは変化しない。
 .PP
-.\"O .BR pwrite ()
-.\"O writes up to
-.\"O .I count
-.\"O bytes from the buffer starting at
-.\"O .I buf
-.\"O to the file descriptor
-.\"O .I fd
-.\"O at offset
-.\"O .IR offset .
-.\"O The file offset is not changed.
-.BR pwrite ()
-は、バッファ
-.I buf
-から最大
-.I count
-バイトをファイルディスクリプタ
-.I fd
-のオフセット
-.I offset
-に書き込む。ファイル・オフセットは変化しない。
+\fBpwrite\fP()  は、バッファー \fIbuf\fP から最大 \fIcount\fP バイトをファイルディスクリプター \fIfd\fP のオフセット
+\fIoffset\fP に書き込む。ファイルオフセットは変化しない。
 .PP
-.\"O The file referenced by
-.\"O .I fd
-.\"O must be capable of seeking.
-.I fd
-で参照されるファイルはシーク (seek) 可能でなければならない。
+\fIfd\fP で参照されるファイルはシーク (seek) 可能でなければならない。
 .SH 返り値
-.\"O On success, the number of bytes read or written is returned (zero
-.\"O indicates that nothing was written, in the case of
-.\"O .BR pwrite (),
-.\"O or
-.\"O end of file, in the case of
-.\"O .BR pread ()),
-.\"O or \-1 on error, in which case
-.\"O .I errno
-.\"O is set to indicate the error.
-成功した場合、読み書きを行ったバイト数が返される (ゼロは、
-.BR pwrite ()
-の場合には何も書かれなかったことを意味し、
-.BR pread ()
-の場合にはファイル
-の末尾に達したことを意味する)。
-エラーの場合は \-1 が返され、
-.I errno
-がそのエラーを示すように設定される。
+成功した場合、読み書きを行ったバイト数が返される (ゼロは、 \fBpwrite\fP()  の場合には何も書かれなかったことを意味し、 \fBpread\fP()
+の場合にはファイル の末尾に達したことを意味する)。 エラーの場合は \-1 が返され、 \fIerrno\fP がそのエラーを示すように設定される。
 .SH エラー
-.\"O .BR pread ()
-.\"O can fail and set
-.\"O .I errno
-.\"O to any error specified for
-.\"O .BR read (2)
-.\"O or
-.\"O .BR lseek (2).
-.BR pread ()
-では、
-.BR read (2)
-および
-.BR lseek (2)
-で規定された全てのエラーが発生する可能性があり、
-.I error
-にはエラーを示す値が設定される。
-.\"O .BR pwrite ()
-.\"O can fail and set
-.\"O .I errno
-.\"O to any error specified for
-.\"O .BR write (2)
-.\"O or
-.\"O .BR lseek (2).
-.BR pwrite ()
-では、
-.BR write (2)
-および
-.BR lseek (2)
-で規定された全てのエラーが発生する可能性があり、
-.I error
-にはエラーを示す値が設定される。
-.\"O .SH VERSIONS
+\fBpread\fP()  では、 \fBread\fP(2)  および \fBlseek\fP(2)  で規定された全てのエラーが発生する可能性があり、
+\fIerrno\fP にはエラーを示す値が設定される。 \fBpwrite\fP()  では、 \fBwrite\fP(2)  および \fBlseek\fP(2)
+で規定された全てのエラーが発生する可能性があり、 \fIerrno\fP にはエラーを示す値が設定される。
 .SH バージョン
-.\"O The
-.\"O .BR pread ()
-.\"O and
-.\"O .BR pwrite ()
-.\"O system calls were added to Linux in
-.\"O version 2.1.60; the entries in the i386 system call table were added
-.\"O in 2.1.69.
-.\"O C library support (including emulation using
-.\"O .BR lseek (2)
-.\"O on older kernels without the system calls) was added in glibc 2.1.
-システムコール
-.BR pread ()
-と
-.BR pwrite ()
-は Linux にバージョン 2.1.60 で追加された。
-i386 のシステムコールのエントリは 2.1.69 で追加された。
-(システムコールを持たない古いカーネルでの
-.BR lseek (2)
-を使ったエミュレーションを含めると)
-C ライブラリにおけるサポートは glibc 2.1 で追加された。
-.\"O .SH "CONFORMING TO"
+システムコール \fBpread\fP()  と \fBpwrite\fP()  は Linux にバージョン 2.1.60 で追加された。 i386
+のシステムコールのエントリーは 2.1.69 で追加された。 (システムコールを持たない古いカーネルでの \fBlseek\fP(2)
+を使ったエミュレーションを含めると)  C ライブラリにおけるサポートは glibc 2.1 で追加された。
 .SH 準拠
-POSIX.1-2001.
-.\"O .SH "SEE ALSO"
+POSIX.1\-2001.
+.SH 注意
+システムコール \fBpread\fP() と \fBpwrite\fP() は、特にマルチスレッドアプリケーションで役に立つ。 これらを使うと、
+他のスレッドによるファイルオフセットの変更の影響を受けることなく、 複数のスレッドが同じファイルディスクリプターに対して入出力を行うことができる。
+
+Linux では、裏で呼び出されるシステムコールの名前がカーネル 2.6 で変更された。
+\fBpread\fP() は \fBpread64\fP() になり、 \fBpwrite\fP() は \fBpwrite64\fP() になった。
+システムコールの番号は変更されていない。
+glibc の \fBpread\fP() と \fBpwrite\fP() のラッパー関数はこれらの変更を吸収している。
+
+いくつかの 32 ビットアーキテクチャーでは、これらのシステムコールの呼び出し時のシグネチャーが違っています。理由は \fBsyscall\fP(2)
+で説明されている通りです。
+.SH バグ
+.\" FIXME . https://bugzilla.kernel.org/show_bug.cgi?id=43178
+POSIX では、\fBO_APPEND\fP フラグを指定してファイルをオープンした場合、
+\fBpwrite\fP() がデータを書き込む位置に影響を及ぼさないことが
+求められている。しかし、 Linux では、ファイルを \fBO_APPEND\fP 付きで
+オープンした場合、 \fIoffset\fP の値に関わらず、
+\fBpwrite\fP() はファイルの末尾にデータを追記する。
 .SH 関連項目
-.BR lseek (2),
-.BR read (2),
-.BR write (2)
+\fBlseek\fP(2), \fBread\fP(2), \fBreadv\fP(2), \fBwrite\fP(2)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。