1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
24 .TH AIO_WRITE 3 2017-09-15 "" "Linux Programmer's Manual"
26 aio_write \- asynchronous write
30 .BI "int aio_write(struct aiocb *" aiocbp );
32 Link with \fI\-lrt\fP.
36 function queues the I/O request described by the buffer pointed to by
38 This function is the asynchronous analog of
40 The arguments of the call
44 correspond (in order) to the fields
49 of the structure pointed to by
53 for a description of the
59 is not set, the data is written starting at the
61 .IR aiocbp\->aio_offset ,
62 regardless of the file offset.
65 is set, data is written at the end of the file in the same order as
68 After the call, the value of the file offset is unspecified.
70 The "asynchronous" means that this call returns as soon as the
71 request has been enqueued; the write may or may not have completed
72 when the call returns.
73 One tests for completion using
75 The return status of a completed I/O operation can be obtained
77 Asynchronous notification of I/O completion can be obtained by setting
78 .IR aiocbp\->aio_sigevent
84 .B _POSIX_PRIORITIZED_IO
85 is defined, and this file supports it,
86 then the asynchronous operation is submitted at a priority equal
87 to that of the calling process minus
88 .IR aiocbp\->aio_reqprio .
91 .I aiocbp\->aio_lio_opcode
94 No data is written to a regular file beyond its maximum offset.
96 On success, 0 is returned.
97 On error, the request is not enqueued, \-1
100 is set appropriately.
101 If an error is detected only later, it will
104 (returns status \-1) and
106 (error status\(emwhatever one would have gotten in
117 is not a valid file descriptor open for writing.
120 The file is a regular file, we want to write at least one byte,
121 but the starting position is at or beyond the maximum offset for this file.
136 function is available since glibc 2.1.
138 For an explanation of the terms used in this section, see
144 Interface Attribute Value
147 T} Thread safety MT-Safe
150 POSIX.1-2001, POSIX.1-2008.
152 It is a good idea to zero out the control block before use.
153 The control block must not be changed while the write operation
155 The buffer area being written out
156 .\" or the control block of the operation
157 must not be accessed during the operation or undefined results may occur.
158 The memory areas involved must remain valid.
160 Simultaneous I/O operations specifying the same
162 structure produce undefined results.