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

NAME

6       aio_read - asynchronous read from a file (REALTIME)
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

119       None.
120

APPLICATION USAGE

122       The aio_read() function is part of the Asynchronous  Input  and  Output
123       option and need not be available on all implementations.
124

RATIONALE

126       None.
127

FUTURE DIRECTIONS

129       None.
130

SEE ALSO

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