1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .TH AIO_READ 3 2021-03-22 "" "Linux Programmer's Manual"
7 aio_read \- asynchronous read
10 .RI ( librt ", " \-lrt )
15 .BI "int aio_read(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
28 correspond (in order) to the fields
33 of the structure pointed to by
37 for a description of the
41 The data is read starting at the absolute position
42 .IR aiocbp\->aio_offset ,
43 regardless of the file offset.
45 the value of the file offset is unspecified.
47 The "asynchronous" means that this call returns as soon as the
48 request has been enqueued; the read may or may not have completed
49 when the call returns.
50 One tests for completion using
52 The return status of a completed I/O operation can be obtained by
54 Asynchronous notification of I/O completion can be obtained by setting
55 .IR aiocbp\->aio_sigevent
61 .B _POSIX_PRIORITIZED_IO
62 is defined, and this file supports it,
63 then the asynchronous operation is submitted at a priority equal
64 to that of the calling process minus
65 .IR aiocbp\->aio_reqprio .
68 .I aiocbp\->aio_lio_opcode
71 No data is read from a regular file beyond its maximum offset.
73 On success, 0 is returned.
74 On error, the request is not enqueued, \-1
77 is set to indicate the error.
78 If an error is detected only later, it will
81 (returns status \-1) and
83 (error status\(emwhatever one would have gotten in
94 is not a valid file descriptor open for reading.
109 The file is a regular file, we start reading before end-of-file
110 and want at least one byte, but the starting position is past
111 the maximum offset for this file.
115 function is available since glibc 2.1.
117 For an explanation of the terms used in this section, see
125 Interface Attribute Value
128 T} Thread safety MT-Safe
134 POSIX.1-2001, POSIX.1-2008.
136 It is a good idea to zero out the control block before use.
137 The control block must not be changed while the read operation
139 The buffer area being read into
140 .\" or the control block of the operation
141 must not be accessed during the operation or undefined results may occur.
142 The memory areas involved must remain valid.
144 Simultaneous I/O operations specifying the same
146 structure produce undefined results.