1AIO_READ(3) Linux Programmer's Manual AIO_READ(3)
2
3
4
6 aio_read - asynchronous read
7
9 #include <aio.h>
10
11 int aio_read(struct aiocb *aiocbp);
12
13
15 The aio_read() function requests an asynchronous "n = read(fd, buf,
16 count)" with fd, buf, count given by aiocbp->aio_fildes,
17 aiocbp->aio_buf, aiocbp->aio_nbytes, respectively. The return status n
18 can be retrieved upon completion using aio_return(3).
19
20 The data is read starting at the absolute file offset aiocbp->aio_off‐
21 set, regardless of the current file position. After this request, the
22 value of the current file position is unspecified.
23
24 The "asynchronous" means that this call returns as soon as the request
25 has been enqueued; the read may or may not have completed when the call
26 returns. One tests for completion using aio_error(3).
27
28 If _POSIX_PRIORITIZED_IO is defined, and this file supports it, then
29 the asynchronous operation is submitted at a priority equal to that of
30 the calling process minus aiocbp->aio_reqprio.
31
32 The field aiocbp->aio_lio_opcode is ignored.
33
34 No data is read from a regular file beyond its maximum offset.
35
37 On success, 0 is returned. On error the request is not enqueued, -1 is
38 returned, and errno is set appropriately. If an error is first detected
39 later, it will be reported via aio_return(3) (returns status -1) and
40 aio_error(3) (error status whatever one would have gotten in errno,
41 such as EBADF).
42
44 EAGAIN Out of resources.
45
46 EBADF aio_fildes is not a valid file descriptor open for reading.
47
48 EINVAL One or more of aio_offset, aio_reqprio, aio_nbytes are invalid.
49
50 ENOSYS This function is not supported.
51
52 EOVERFLOW
53 The file is a regular file, we start reading before end-of-file
54 and want at least one byte, but the starting position is past
55 the maximum offset for this file.
56
58 It is a good idea to zero out the control block before use. This con‐
59 trol block must not be changed while the read operation is in progress.
60 The buffer area being read into must not be accessed during the opera‐
61 tion or undefined results may occur. The memory areas involved must
62 remain valid.
63
64
66 POSIX.1-2001
67
69 aio_cancel(3), aio_error(3), aio_fsync(3), aio_return(3), aio_sus‐
70 pend(3), aio_write(3)
71
72
73
74 2003-11-14 AIO_READ(3)