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 .TH AIO_WRITE 3 2012-05-08 "" "Linux Programmer's Manual"
25 aio_write \- asynchronous write
29 .BI "int aio_write(struct aiocb *" aiocbp );
31 Link with \fI\-lrt\fP.
35 function queues the I/O request described by the buffer pointed to by
37 This function is the asynchronous analog of
39 The arguments of the call
43 correspond (in order) to the fields
48 of the structure pointed to by
52 for a description of the
58 is not set, the data is written starting at the
60 .IR aiocbp\->aio_offset ,
61 regardless of the current file offset.
64 is set, data is written at the end of the file in the same order as
67 After the call, the value of the current file offset is unspecified.
69 The "asynchronous" means that this call returns as soon as the
70 request has been enqueued; the write may or may not have completed
71 when the call returns.
72 One tests for completion using
74 The return status of a completed I/O operation can be obtained
76 Asynchronous notification of I/O completion can be obtained by setting
77 .IR aiocbp\->aio_sigevent
83 .B _POSIX_PRIORITIZED_IO
84 is defined, and this file supports it,
85 then the asynchronous operation is submitted at a priority equal
86 to that of the calling process minus
87 .IR aiocbp\->aio_reqprio .
90 .I aiocbp\->aio_lio_opcode
93 No data is written to a regular file beyond its maximum offset.
95 On success, 0 is returned.
96 On error the request is not enqueued, \-1
100 If an error is only detected later, it will
103 (returns status \-1) and
105 (error status\(emwhatever one would have gotten in
116 is not a valid file descriptor open for writing.
119 The file is a regular file, we want to write at least one byte,
120 but the starting position is at or beyond the maximum offset for this file.
135 function is available since glibc 2.1.
137 POSIX.1-2001, POSIX.1-2008.
139 It is a good idea to zero out the control block before use.
140 The control block must not be changed while the write operation
142 The buffer area being written out
143 .\" or the control block of the operation
144 must not be accessed during the operation or undefined results may occur.
145 The memory areas involved must remain valid.
147 Simultaneous I/O operations specifying the same
149 structure produce undefined results.