1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
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.
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.
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.
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,
23 .\" Japanese Version Copyright (c) 2004 Yuichi SATO
24 .\" all rights reserved.
25 .\" Translated Sat Jul 10 03:54:47 JST 2004
26 .\" by Yuichi SATO <ysato444@yahoo.co.jp>
28 .TH AIO_WRITE 3 2003-11-14 "" "Linux Programmer's Manual"
31 .\"O aio_write \- asynchronous write
32 aio_write \- ÈóƱ´ü¤Ç½ñ¤¹þ¤à
37 .BI "int aio_write(struct aiocb *" aiocbp );
39 .\"O Link with \fI\-lrt\fP.
40 \fI\-lrt\fP ¤Ç¥ê¥ó¥¯¤¹¤ë¡£
45 .\"O function requests an asynchronous "n = write(fd, buf, count)"
46 .\"O with fd, buf, count given by
47 .\"O .IR aiocbp\->aio_fildes ,
48 .\"O .IR aiocbp\->aio_buf ,
49 .\"O .IR aiocbp\->aio_nbytes ,
51 .\"O The return status n can be retrieved upon completion using
52 .\"O .BR aio_return (3).
54 ´Ø¿ô¤ÏÈóƱ´ü¤Î "n = write(fd, buf, count)" ¤ò¥ê¥¯¥¨¥¹¥È¤¹¤ë¡£
55 ¤³¤³¤Ç fd, buf, count ¤Ï¡¢¤½¤ì¤¾¤ì
56 .IR aiocbp\->aio_fildes ,
57 .IR aiocbp\->aio_buf ,
58 .I aiocbp\->aio_nbytes
60 ÊÖ¤êÃÍ (return status) n ¤Ï¡¢´°Î»»þ¤Ë
66 .\"O is not set, the data is written starting at the
67 .\"O absolute file offset
68 .\"O .IR aiocbp\->aio_offset ,
69 .\"O regardless of the current file position.
71 ¤¬ÀßÄꤵ¤ì¤Ê¤¤¾ì¹ç¡¢¥«¥ì¥ó¥È¤Î¥Õ¥¡¥¤¥ë°ÌÃ֤˴ط¸¤Ê¤¯¡¢
72 ¥Ç¡¼¥¿¤ÏÀäÂÐ¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È
73 .I aiocbp\->aio_offset
74 ¤ò³«»ÏÅÀ¤È¤·¤Æ½ñ¤¹þ¤Þ¤ì¤ë¡£
77 .\"O is set, the data is written at the end of the file.
79 ¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¡¢¥Ç¡¼¥¿¤Ï¥Õ¥¡¥¤¥ë¤Î½ªÃ¼¤Ë½ñ¤¹þ¤Þ¤ì¤ë¡£
80 .\"O After this request, the value of the current file position is unspecified.
81 ¤³¤Î¥ê¥¯¥¨¥¹¥È¤Î¸å¤Î¡¢¥«¥ì¥ó¥È¤Î¥Õ¥¡¥¤¥ë°ÌÃ֤ϵ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
83 .\"O The "asynchronous" means that this call returns as soon as the
84 .\"O request has been enqueued; the write may or may not have completed
85 .\"O when the call returns.
86 .\"O One tests for completion using
87 .\"O .BR aio_error (3).
88 ¡ÖÈóƱ´ü¡×¤È¤Ï¡Ö¥ê¥¯¥¨¥¹¥È¤¬¥¥å¡¼¤ËÆþ¤ì¤é¤ì¤¿¤é¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤Ï¤¹¤°¤ËÊÖ¤ë¡×
90 ¸Æ¤Ó½Ð¤·¤«¤éÌá¤Ã¤¿»þ¤Ë¡¢½ñ¤¹þ¤ß¤Ï´°Î»¤·¤Æ¤¤¤ë¤«¤âÃΤì¤Ê¤¤¤·¡¢
91 ´°Î»¤·¤Æ¤¤¤Ê¤¤¤«¤âÃΤì¤Ê¤¤¡£
93 ¤ò»È¤¦¤³¤È¤Ç´°Î»¤·¤¿¤«¤ò¥Æ¥¹¥È¤Ç¤¤ë¡£
96 .\"O .B _POSIX_PRIORITIZED_IO
97 .\"O is defined, and this file supports it,
98 .\"O then the asynchronous operation is submitted at a priority equal
99 .\"O to that of the calling process minus
100 .\"O .IR aiocbp\->aio_reqprio .
101 .B _POSIX_PRIORITIZED_IO
103 ¤«¤Ä¥Õ¥¡¥¤¥ë¤¬¤³¤ì¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
104 ÈóƱ´üÁàºî¤Ï¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤ÎÍ¥ÀèÅÙ¤«¤é
105 .I aiocbp\->aio_reqprio
106 ¤ò°ú¤¤¤¿Í¥ÀèÅÙ¤ÇÅÐÏ¿ (submit) ¤µ¤ì¤ë¡£
109 .\"O .I aiocbp\->aio_lio_opcode
112 .I aiocbp\->aio_lio_opcode
115 .\"O No data is written to a regular file beyond its maximum offset.
116 ºÇÂ祪¥Õ¥»¥Ã¥È¤òĶ¤¨¤¿Ä̾ï¤Î¥Õ¥¡¥¤¥ë¤Ë¤Ï¡¢²¿¤â¥Ç¡¼¥¿¤¬½ñ¤¹þ¤Þ¤ì¤Ê¤¤¡£
117 .\"O .SH "RETURN VALUE"
119 .\"O On success, 0 is returned.
120 .\"O On error the request is not enqueued, \-1
121 .\"O is returned, and
123 .\"O is set appropriately.
124 .\"O If an error is first detected later, it will
126 .\"O .BR aio_return (3)
127 .\"O (returns status \-1) and
128 .\"O .BR aio_error (3)
129 .\"O (error status whatever one would have gotten in
133 À®¸ù¤·¤¿¾ì¹ç¡¢0 ¤¬ÊÖ¤µ¤ì¤ë¡£
134 ¥¨¥é¡¼¤Î¾ì¹ç¡¢¥ê¥¯¥¨¥¹¥È¤Ï¥¥å¡¼¤ËÆþ¤ì¤é¤ì¤º¡¢
138 ¥¨¥é¡¼¤ÏºÇ½é¤Ë¸¡ÃΤµ¤ì¤¿¸å¤Ç¡¢
145 ¤Î¤è¤¦¤Ê¥¨¥é¡¼¾õÂÖ¤òÊÖ¤¹)
152 .\"O Out of resources.
157 .\"O is not a valid file descriptor open for writing.
159 ¤Ï½ñ¤¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤¿Í¸ú¤Ê¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¡£
162 .\"O The file is a regular file, we want to write at least one byte,
163 .\"O but the starting position is at or beyond the maximum offset for this file.
164 ¥Õ¥¡¥¤¥ë¤ÏÄ̾ï¤Î¥Õ¥¡¥¤¥ë¤Ç¤¢¤ê¡¢¾¯¤Ê¤¯¤È¤â 1 ¥Ð¥¤¥È¤ò½ñ¤¹þ¤â¤¦¤È¤·¤Æ¤¤¤ë¡£
165 ¤·¤«¤·³«»Ï°ÌÃÖ¤¬¡¢¤³¤Î¥Õ¥¡¥¤¥ë¤ÎºÇÂ祪¥Õ¥»¥Ã¥È¤ÈƱ¤¸¤«¤½¤ì¤òĶ¤¨¤Æ¤¤¤ë¡£
169 .\"O .IR aio_offset ,
170 .\"O .IR aio_reqprio ,
176 ¤Î¤¦¤Á 1 ¤Ä°Ê¾å¤¬Ìµ¸ú¤Ç¤¢¤ë¡£
179 .\"O This function is not supported.
180 ¤³¤Î´Ø¿ô¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
181 .\"O .SH "CONFORMING TO"
186 .\"O It is a good idea to zero out the control block before use.
187 »ÈÍѤ¹¤ëÁ°¤ËÀ©¸æ¥Ö¥í¥Ã¥¯¤ò 0 ¤Ë¤·¤Æ¤ª¤¯¤Î¤Ï¡¢¤è¤¤¹Í¤¨¤Ç¤¢¤ë¡£
188 .\"O This control block must not be changed while the write operation
190 ¤³¤ÎÀ©¸æ¥Ö¥í¥Ã¥¯¤Ï¡¢Æɤ߹þ¤ßÁàºî¤¬¿Ê¹Ô¤·¤Æ¤¤¤ë´Ö¤ÏÊѹ¹¤¹¤Ù¤¤Ç¤Ê¤¤¡£
191 .\"O The buffer area being written out
192 .\"O .\" or the control block of the operation
193 .\"O must not be accessed during the operation or undefined results may
195 .\"O The memory areas involved must remain valid.
196 Æɤ߹þ¤Þ¤ì¤ë¥Ð¥Ã¥Õ¥¡Îΰè¤Ï
197 .\" ¤Þ¤¿¤ÏÁàºî¤ÎÀ©¸æ¥Ö¥í¥Ã¥¯¤Ï
198 Áàºî¤ÎºÇÃæ¤Ë¥¢¥¯¥»¥¹¤¹¤Ù¤¤Ç¤Ï¤Ê¤¤¡£
199 ¤µ¤â¤Ê¤¤¤Èµ¯¤³¤ë·ë²Ì¤¬ÉÔÄê¤Ë¤Ê¤ë¡£
200 ¤³¤ì¤Ë´Þ¤Þ¤ì¤ë¥á¥â¥êÎΰè¤Ï¡¢Í¸ú¤Ê¤Þ¤Þ¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£