.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, write to the Free .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, .\" USA. .\" .\" Japanese Version Copyright (c) 2004 Yuichi SATO .\" all rights reserved. .\" Translated Sat Jul 10 03:54:47 JST 2004 .\" by Yuichi SATO .\" .TH AIO_WRITE 3 2003-11-14 "" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O aio_write \- asynchronous write aio_write \- 非同期で書き込む .\"O .SH SYNOPSIS .SH 書式 .B "#include " .sp .BI "int aio_write(struct aiocb *" aiocbp ); .sp .\"O Link with \fI\-lrt\fP. \fI\-lrt\fP でリンクする。 .\"O .SH DESCRIPTION .SH 説明 .\"O The .\"O .BR aio_write () .\"O function requests an asynchronous "n = write(fd, buf, count)" .\"O with fd, buf, count given by .\"O .IR aiocbp\->aio_fildes , .\"O .IR aiocbp\->aio_buf , .\"O .IR aiocbp\->aio_nbytes , .\"O respectively. .\"O The return status n can be retrieved upon completion using .\"O .BR aio_return (3). .BR aio_write () 関数は非同期の "n = write(fd, buf, count)" をリクエストする。 ここで fd, buf, count は、それぞれ .IR aiocbp\->aio_fildes , .IR aiocbp\->aio_buf , .I aiocbp\->aio_nbytes で与えられる。 返り値 (return status) n は、完了時に .BR aio_return (3) を使って取得できる。 .LP .\"O If .\"O .B O_APPEND .\"O is not set, the data is written starting at the .\"O absolute file offset .\"O .IR aiocbp\->aio_offset , .\"O regardless of the current file position. .B O_APPEND が設定されない場合、カレントのファイル位置に関係なく、 データは絶対ファイルオフセット .I aiocbp\->aio_offset を開始点として書き込まれる。 .\"O If .\"O .B O_APPEND .\"O is set, the data is written at the end of the file. .B O_APPEND が設定されている場合、データはファイルの終端に書き込まれる。 .\"O After this request, the value of the current file position is unspecified. このリクエストの後の、カレントのファイル位置は規定されていない。 .LP .\"O The "asynchronous" means that this call returns as soon as the .\"O request has been enqueued; the write may or may not have completed .\"O when the call returns. .\"O One tests for completion using .\"O .BR aio_error (3). 「非同期」とは「リクエストがキューに入れられたら、この呼び出しはすぐに返る」 ということである。 呼び出しから戻った時に、書き込みは完了しているかも知れないし、 完了していないかも知れない。 .BR aio_error (3) を使うことで完了したかをテストできる。 .LP .\"O If .\"O .B _POSIX_PRIORITIZED_IO .\"O is defined, and this file supports it, .\"O then the asynchronous operation is submitted at a priority equal .\"O to that of the calling process minus .\"O .IR aiocbp\->aio_reqprio . .B _POSIX_PRIORITIZED_IO が定義されていて、 かつファイルがこれをサポートしている場合、 非同期操作は呼び出したプロセスの優先度から .I aiocbp\->aio_reqprio を引いた優先度で登録 (submit) される。 .LP .\"O The field .\"O .I aiocbp\->aio_lio_opcode .\"O is ignored. フィールド .I aiocbp\->aio_lio_opcode は無視される。 .LP .\"O No data is written to a regular file beyond its maximum offset. 最大オフセットを超えた通常のファイルには、何もデータが書き込まれない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O On success, 0 is returned. .\"O On error the request is not enqueued, \-1 .\"O is returned, and .\"O .I errno .\"O is set appropriately. .\"O If an error is first detected later, it will .\"O be reported via .\"O .BR aio_return (3) .\"O (returns status \-1) and .\"O .BR aio_error (3) .\"O (error status whatever one would have gotten in .\"O .IR errno , .\"O such as .\"O .BR EBADF ). 成功した場合、0 が返される。 エラーの場合、リクエストはキューに入れられず、 \-1 が返されて、 .I errno が適切に設定される。 エラーは最初に検知された後で、 (状態 \-1 を返す) .BR aio_return (3) と .RI ( errno で取得できる .B EBADF のようなエラー状態を返す) .BR aio_error (3) で報告されるだろう。 .\"O .SH ERRORS .SH エラー .TP .B EAGAIN .\"O Out of resources. リソースが足りない。 .TP .B EBADF .\"O .I aio_fildes .\"O is not a valid file descriptor open for writing. .I aio_fildes は書き込みのためにオープンされた有効なファイルディスクリプタでない。 .TP .B EFBIG .\"O The file is a regular file, we want to write at least one byte, .\"O but the starting position is at or beyond the maximum offset for this file. ファイルは通常のファイルであり、少なくとも 1 バイトを書き込もうとしている。 しかし開始位置が、このファイルの最大オフセットと同じかそれを超えている。 .TP .B EINVAL .\"O One or more of .\"O .IR aio_offset , .\"O .IR aio_reqprio , .\"O .I aio_nbytes .\"O are invalid. .IR aio_offset , .IR aio_reqprio , .I aio_nbytes のうち 1 つ以上が無効である。 .TP .B ENOSYS .\"O This function is not supported. この関数がサポートされていない。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O .SH NOTES .SH 注意 .\"O It is a good idea to zero out the control block before use. 使用する前に制御ブロックを 0 にしておくのは、よい考えである。 .\"O This control block must not be changed while the write operation .\"O is in progress. この制御ブロックは、読み込み操作が進行している間は変更すべきでない。 .\"O The buffer area being written out .\"O .\" or the control block of the operation .\"O must not be accessed during the operation or undefined results may .\"O occur. .\"O The memory areas involved must remain valid. 読み込まれるバッファ領域は .\" または操作の制御ブロックは 操作の最中にアクセスすべきではない。 さもないと起こる結果が不定になる。 これに含まれるメモリ領域は、有効なままにしなければならない。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR aio_cancel (3), .BR aio_error (3), .BR aio_fsync (3), .BR aio_read (3), .BR aio_return (3), .BR aio_suspend (3)