OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / LDP_man-pages / release / man3 / aio_read.3
1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
24 .\"         all rights reserved.
25 .\" Translated Mon Jul  5 00:46:45 JST 2004
26 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
27 .\"
28 .TH AIO_READ 3 2003-11-14  "" "Linux Programmer's Manual"
29 .SH 名前
30 aio_read \- 非同期で読み込む
31 .SH 書式
32 .B "#include <aio.h>"
33 .sp
34 .BI "int aio_read(struct aiocb *" aiocbp );
35 .sp
36 \fI\-lrt\fP でリンクする。
37 .SH 説明
38 .BR aio_read ()
39 関数は非同期の "n = read(fd, buf, count)" をリクエストする。
40 ここで fd, buf, count は、それぞれ
41 .IR aiocbp\->aio_fildes ,
42 .IR aiocbp\->aio_buf ,
43 .I aiocbp\->aio_nbytes
44 で与えられる。
45 返り値 (return status) n は、完了時に
46 .BR aio_return (3)
47 を使って取得できる。
48 .LP
49 データは、カレントのファイル位置に関係なく、絶対ファイルオフセット
50 .I aiocbp\->aio_offset
51 を開始点として読み込まれる。
52 このリクエスト後の、カレントのファイル位置は規定されていない。
53 .LP
54 「非同期」とは「リクエストがキューに入れられたら、この呼び出しはすぐに返る」
55 ということである。
56 呼び出しから戻った時に、読み込みは完了しているかも知れないし、
57 完了していないかも知れない。
58 .BR aio_error (3)
59 を使うことで完了したかをテストできる。
60 .LP
61 .B _POSIX_PRIORITIZED_IO
62 が定義されていて、
63 かつファイルがこれをサポートしている場合、
64 非同期操作は呼び出したプロセスの優先度から
65 .I aiocbp\->aio_reqprio
66 を引いた優先度で登録 (submit) される。
67 .LP
68 フィールド
69 .I aiocbp\->aio_lio_opcode
70 は無視される。
71 .LP
72 最大オフセットを超えた通常のファイルからは、何もデータが読み込まれない。
73 .SH 返り値
74 成功した場合、0 が返される。
75 エラーの場合、リクエストはキューに入れられず、
76 \-1 が返されて、
77 .I errno
78 が適切に設定される。
79 エラーは最初に検知された後で、
80 (状態 \-1 を返す)
81 .BR aio_return (3)
82
83 .RI ( errno
84 で取得できる
85 .B EBADF
86 のようなエラー状態を返す)
87 .BR aio_error (3)
88 で報告されるだろう。
89 .SH エラー
90 .TP
91 .B EAGAIN
92 リソースが足りない。
93 .TP
94 .B EBADF
95 .I aio_fildes
96 は読み込みのためにオープンされた有効なファイルディスクリプタでない。
97 .TP
98 .B EINVAL
99 .IR aio_offset ,
100 .IR aio_reqprio ,
101 .I aio_nbytes
102 のうち 1 つ以上が無効である。
103 .TP
104 .B ENOSYS
105 この関数がサポートされていない。
106 .TP
107 .B EOVERFLOW
108 ファイルが通常のファイルであり、
109 ファイルの終端の前から読み込みを開始して、
110 少なくとも 1 バイトを読み込もうとした。
111 しかし開始位置がこのファイルの最大オフセットを超えていた。
112 .SH 準拠
113 POSIX.1-2001.
114 .SH 注意
115 使用する前に制御ブロックを 0 にしておくのは、よい考えである。
116 この制御ブロックは、読み込み操作が進行している間は変更すべきでない。
117 読み込まれるバッファ領域は
118 .\" または操作の制御ブロックは
119 操作の最中にアクセスすべきではない。
120 さもないと起こる結果が不定になる。
121 これに含まれるメモリ領域は、有効なままにしなければならない。
122 .SH 関連項目
123 .BR aio_cancel (3),
124 .BR aio_error (3),
125 .BR aio_fsync (3),
126 .BR aio_return (3),
127 .BR aio_suspend (3),
128 .BR aio_write (3)