1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .TH aio_write 3 (date) "Linux man-pages (unreleased)"
7 aio_write \- asynchronous write
10 .RI ( librt ", " \-lrt )
15 .BI "int aio_write(struct aiocb *" aiocbp );
20 function queues the I/O request described by the buffer pointed to by
22 This function is the asynchronous analog of
24 The arguments of the call
32 correspond (in order) to the fields
37 of the structure pointed to by
41 for a description of the
47 is not set, the data is written starting at the
49 .IR aiocbp\->aio_offset ,
50 regardless of the file offset.
53 is set, data is written at the end of the file in the same order as
56 After the call, the value of the file offset is unspecified.
58 The "asynchronous" means that this call returns as soon as the
59 request has been enqueued; the write may or may not have completed
60 when the call returns.
61 One tests for completion using
63 The return status of a completed I/O operation can be obtained
65 Asynchronous notification of I/O completion can be obtained by setting
66 .I aiocbp\->aio_sigevent
72 .B _POSIX_PRIORITIZED_IO
73 is defined, and this file supports it,
74 then the asynchronous operation is submitted at a priority equal
75 to that of the calling process minus
76 .IR aiocbp\->aio_reqprio .
79 .I aiocbp\->aio_lio_opcode
82 No data is written to a regular file beyond its maximum offset.
84 On success, 0 is returned.
85 On error, the request is not enqueued, \-1
88 is set to indicate the error.
89 If an error is detected only later, it will
92 (returns status \-1) and
94 (error status\(emwhatever one would have gotten in
105 is not a valid file descriptor open for writing.
108 The file is a regular file, we want to write at least one byte,
109 but the starting position is at or beyond the maximum offset for this file.
124 function is available since glibc 2.1.
126 For an explanation of the terms used in this section, see
134 Interface Attribute Value
137 T} Thread safety MT-Safe
143 POSIX.1-2001, POSIX.1-2008.
145 It is a good idea to zero out the control block before use.
146 The control block must not be changed while the write operation
148 The buffer area being written out
149 .\" or the control block of the operation
150 must not be accessed during the operation or undefined results may occur.
151 The memory areas involved must remain valid.
153 Simultaneous I/O operations specifying the same
155 structure produce undefined results.