#include <aio.h> int aio_write(struct aiocb *aiocbp);
If prioritized I/O is supported for this file, then the asynchronous
operation shall be submitted at a priority equal to a base scheduling
priority minus aiocbp->aio_reqprio. If Thread Execution
Scheduling is not supported, then the base scheduling priority is that
of the calling process;
otherwise, the base scheduling priority is that of the calling thread.
The aiocbp argument may be used as an argument to aio_error() and aio_return() in order to determine the error status and return status, respectively, of the asynchronous operation while it is proceeding.
The aiocbp argument points to an aiocb structure. If the buffer pointed to by aiocbp->aio_buf or the control block pointed to by aiocbp becomes an illegal address prior to asynchronous I/O completion, then the behavior is undefined.
If O_APPEND is not set for the file descriptor aio_fildes, then the requested operation shall take place at the absolute position in the file as given by aio_offset, as if lseek() were called immediately prior to the operation with an offset equal to aio_offset and a whence equal to SEEK_SET. If O_APPEND is set for the file descriptor, or if aio_fildes is associated with a device that is incapable of seeking, write operations append to the file in the same order as the calls were made, except under circumstances described in Section 2.8.2, Asynchronous I/O. After a successful call to enqueue an asynchronous I/O operation, the value of the file offset for the file is unspecified.
The aio_sigevent member specifies the notification which occurs when the request is completed.
The aiocbp->aio_lio_opcode field shall be ignored by aio_write().
Simultaneous asynchronous operations using the same aiocbp produce undefined results.
If synchronized I/O is enabled on the file associated with aiocbp->aio_fildes, the behavior of this function shall be according to the definitions of synchronized I/O data integrity completion, and synchronized I/O file integrity completion.
For any system action that changes the process memory space while an asynchronous I/O is outstanding to the address range being changed, the result of that action is undefined.
Each of the following conditions may be detected synchronously at the time of the call to aio_write(), or asynchronously. If any of the conditions below are detected synchronously, the aio_write() function shall return -1 and set errno to the corresponding value. If any of the conditions below are detected asynchronously, the return status of the asynchronous operation shall be set to -1, and the error status of the asynchronous operation is set to the corresponding value.
In the case that the aio_write() successfully queues the I/O operation, the return status of the asynchronous operation shall be one of the values normally returned by the write() function call. If the operation is successfully queued but is subsequently canceled or encounters an error, the error status for the asynchronous operation contains one of the values normally set by the write() function call, or one of the following:
The following condition may be detected synchronously or asynchronously:
The Base Definitions volume of POSIX.1-2008, <aio.h>
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .