1AIO_READ(3)                Linux Programmer's Manual               AIO_READ(3)
2
3
4

NAME

6       aio_read - asynchronous read
7

SYNOPSIS

9       #include <aio.h>
10
11       int aio_read(struct aiocb *aiocbp);
12
13       Link with -lrt.
14

DESCRIPTION

16       The  aio_read()  function  requests  an asynchronous "n = read(fd, buf,
17       count)"   with   fd,   buf,   count   given   by    aiocbp->aio_fildes,
18       aiocbp->aio_buf, aiocbp->aio_nbytes, respectively.  The return status n
19       can be retrieved upon completion using aio_return(3).
20
21       The data is read starting at the absolute file offset  aiocbp->aio_off‐
22       set,  regardless of the current file position.  After this request, the
23       value of the current file position is unspecified.
24
25       The "asynchronous" means that this call returns as soon as the  request
26       has been enqueued; the read may or may not have completed when the call
27       returns.  One tests for completion using aio_error(3).
28
29       If _POSIX_PRIORITIZED_IO is defined, and this file  supports  it,  then
30       the  asynchronous operation is submitted at a priority equal to that of
31       the calling process minus aiocbp->aio_reqprio.
32
33       The field aiocbp->aio_lio_opcode is ignored.
34
35       No data is read from a regular file beyond its maximum offset.
36

RETURN VALUE

38       On success, 0 is returned.  On error the request is not enqueued, -1 is
39       returned,  and  errno  is  set  appropriately.   If  an  error is first
40       detected later, it will be reported via aio_return(3)  (returns  status
41       -1)  and  aio_error(3)  (error status whatever one would have gotten in
42       errno, such as EBADF).
43

ERRORS

45       EAGAIN Out of resources.
46
47       EBADF  aio_fildes is not a valid file descriptor open for reading.
48
49       EINVAL One or more of aio_offset, aio_reqprio, aio_nbytes are invalid.
50
51       ENOSYS This function is not supported.
52
53       EOVERFLOW
54              The file is a regular file, we start reading before  end-of-file
55              and  want  at  least one byte, but the starting position is past
56              the maximum offset for this file.
57

CONFORMING TO

59       POSIX.1-2001.
60

NOTES

62       It is a good idea to zero out the control block before use.  This  con‐
63       trol block must not be changed while the read operation is in progress.
64       The buffer area being read into must not be accessed during the  opera‐
65       tion  or  undefined  results may occur.  The memory areas involved must
66       remain valid.
67

SEE ALSO

69       aio_cancel(3),  aio_error(3),  aio_fsync(3),  aio_return(3),   aio_sus‐
70       pend(3), aio_write(3)
71

COLOPHON

73       This  page  is  part of release 3.22 of the Linux man-pages project.  A
74       description of the project, and information about reporting  bugs,  can
75       be found at http://www.kernel.org/doc/man-pages/.
76
77
78
79                                  2003-11-14                       AIO_READ(3)
Impressum