1AIO_READ(3P)               POSIX Programmer's Manual              AIO_READ(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       aio_read - asynchronous read from a file (REALTIME)
13

SYNOPSIS

15       #include <aio.h>
16
17       int aio_read(struct aiocb *aiocbp);
18
19

DESCRIPTION

21       The aio_read() function shall read  aiocbp->aio_nbytes  from  the  file
22       associated  with  aiocbp->aio_fildes  into  the  buffer  pointed  to by
23       aiocbp->aio_buf.  The function call shall return when the read  request
24       has  been initiated or queued to the file or device (even when the data
25       cannot be delivered immediately).
26
27       If prioritized I/O is supported for this file,  then  the  asynchronous
28       operation shall be submitted at a priority equal to the scheduling pri‐
29       ority of the process minus aiocbp->aio_reqprio.
30
31       The aiocbp value  may  be  used  as  an  argument  to  aio_error()  and
32       aio_return()  in order to determine the error status and return status,
33       respectively, of the asynchronous operation while it is proceeding.  If
34       an  error  condition  is  encountered during queuing, the function call
35       shall return without  having  initiated  or  queued  the  request.  The
36       requested operation takes place at the absolute position in the file as
37       given by aio_offset, as if lseek() were called immediately prior to the
38       operation  with  an  offset  equal  to aio_offset and a whence equal to
39       SEEK_SET. After a successful call to enqueue an asynchronous I/O opera‐
40       tion, the value of the file offset for the file is unspecified.
41
42       The aiocbp->aio_lio_opcode field shall be ignored by aio_read().
43
44       The aiocbp argument points to an aiocb structure. If the buffer pointed
45       to by aiocbp->aio_buf or the control block pointed to by aiocbp becomes
46       an  illegal  address  prior  to  asynchronous  I/O completion, then the
47       behavior is undefined.
48
49       Simultaneous asynchronous operations  using  the  same  aiocbp  produce
50       undefined results.
51
52       If   synchronized   I/O   is   enabled  on  the  file  associated  with
53       aiocbp->aio_fildes, the behavior of this function shall be according to
54       the  definitions of synchronized I/O data integrity completion and syn‐
55       chronized I/O file integrity completion.
56
57       For any system action that changes the process memory  space  while  an
58       asynchronous I/O is outstanding to the address range being changed, the
59       result of that action is undefined.
60
61       For regular files, no data transfer shall occur past the offset maximum
62       established    in   the   open   file   description   associated   with
63       aiocbp->aio_fildes.
64

RETURN VALUE

66       The aio_read() function shall return the  value  zero  to  the  calling
67       process  if  the  I/O  operation is successfully queued; otherwise, the
68       function shall return the value -1 and set errno to indicate the error.
69

ERRORS

71       The aio_read() function shall fail if:
72
73       EAGAIN The requested asynchronous I/O operation was not queued  due  to
74              system resource limitations.
75
76
77       Each  of  the following conditions may be detected synchronously at the
78       time of the call to aio_read(), or asynchronously.  If any of the  con‐
79       ditions below are detected synchronously, the aio_read() function shall
80       return -1 and set errno to the corresponding value. If any of the  con‐
81       ditions  below  are  detected  asynchronously, the return status of the
82       asynchronous operation is set to -1, and the error status of the  asyn‐
83       chronous operation is set to the corresponding value.
84
85       EBADF  The  aiocbp->aio_fildes  argument is not a valid file descriptor
86              open for reading.
87
88       EINVAL The file offset value implied  by  aiocbp->aio_offset  would  be
89              invalid,   aiocbp->aio_reqprio   is   not   a  valid  value,  or
90              aiocbp->aio_nbytes is an invalid value.
91
92
93       In the case that the aio_read() successfully queues the  I/O  operation
94       but  the operation is subsequently canceled or encounters an error, the
95       return status of the asynchronous operation is one of the  values  nor‐
96       mally returned by the read() function call. In addition, the error sta‐
97       tus of the asynchronous operation is set to one of the  error  statuses
98       normally  set by the read() function call, or one of the following val‐
99       ues:
100
101       EBADF  The aiocbp->aio_fildes argument is not a valid  file  descriptor
102              open for reading.
103
104       ECANCELED
105              The  requested  I/O was canceled before the I/O completed due to
106              an explicit aio_cancel() request.
107
108       EINVAL The file offset value implied  by  aiocbp->aio_offset  would  be
109              invalid.
110
111
112       The   following  condition  may  be  detected  synchronously  or  asyn‐
113       chronously:
114
115       EOVERFLOW
116              The file is a regular file, aiobcp->aio_nbytes is  greater  than
117              0,  and  the starting offset in aiobcp->aio_offset is before the
118              end-of-file and is at or beyond the offset maximum in  the  open
119              file description associated with aiocbp->aio_fildes.
120
121
122       The following sections are informative.
123

EXAMPLES

125       None.
126

APPLICATION USAGE

128       The  aio_read()  function  is part of the Asynchronous Input and Output
129       option and need not be available on all implementations.
130

RATIONALE

132       None.
133

FUTURE DIRECTIONS

135       None.
136

SEE ALSO

138       aio_cancel(),  aio_error(),  lio_listio(),  aio_return(),  aio_write(),
139       close(),  exec(), exit(), fork(), lseek(), read(), the Base Definitions
140       volume of IEEE Std 1003.1-2001, <aio.h>
141
143       Portions of this text are reprinted and reproduced in  electronic  form
144       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
145       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
146       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
147       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
148       event of any discrepancy between this version and the original IEEE and
149       The Open Group Standard, the original IEEE and The Open Group  Standard
150       is  the  referee document. The original Standard can be obtained online
151       at http://www.opengroup.org/unix/online.html .
152
153
154
155IEEE/The Open Group                  2003                         AIO_READ(3P)
Impressum