]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/aio_read.3
Even when the CONFORMING TO section is just a list of standards,
[thirdparty/man-pages.git] / man3 / aio_read.3
1 .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .TH AIO_READ 3 2003-11-14 "" "Linux Programmer's Manual"
24 .SH NAME
25 aio_read \- asynchronous read
26 .SH SYNOPSIS
27 .B "#include <aio.h>"
28 .sp
29 .BI "int aio_read(struct aiocb *" aiocbp );
30 .sp
31 Link with \fI\-lrt\fP.
32 .SH DESCRIPTION
33 The
34 .BR aio_read ()
35 function requests an asynchronous "n = read(fd, buf, count)"
36 with fd, buf, count given by
37 .IR aiocbp\->aio_fildes ,
38 .IR aiocbp\->aio_buf ,
39 .IR aiocbp\->aio_nbytes ,
40 respectively.
41 The return status n can be retrieved upon completion using
42 .BR aio_return (3).
43 .LP
44 The data is read starting at the absolute file offset
45 .IR aiocbp\->aio_offset ,
46 regardless of the current file position.
47 After this request,
48 the value of the current file position is unspecified.
49 .LP
50 The "asynchronous" means that this call returns as soon as the
51 request has been enqueued; the read may or may not have completed
52 when the call returns.
53 One tests for completion using
54 .BR aio_error (3).
55 .LP
56 If
57 .B _POSIX_PRIORITIZED_IO
58 is defined, and this file supports it,
59 then the asynchronous operation is submitted at a priority equal
60 to that of the calling process minus
61 .IR aiocbp\->aio_reqprio .
62 .LP
63 The field
64 .I aiocbp\->aio_lio_opcode
65 is ignored.
66 .LP
67 No data is read from a regular file beyond its maximum offset.
68 .SH "RETURN VALUE"
69 On success, 0 is returned.
70 On error the request is not enqueued, \-1
71 is returned, and
72 .I errno
73 is set appropriately.
74 If an error is first detected later, it will
75 be reported via
76 .BR aio_return (3)
77 (returns status \-1) and
78 .BR aio_error (3)
79 (error status whatever one would have gotten in
80 .IR errno ,
81 such as
82 .BR EBADF ).
83 .SH ERRORS
84 .TP
85 .B EAGAIN
86 Out of resources.
87 .TP
88 .B EBADF
89 .I aio_fildes
90 is not a valid file descriptor open for reading.
91 .TP
92 .B EINVAL
93 One or more of
94 .IR aio_offset ,
95 .IR aio_reqprio ,
96 .I aio_nbytes
97 are invalid.
98 .TP
99 .B ENOSYS
100 This function is not supported.
101 .TP
102 .B EOVERFLOW
103 The file is a regular file, we start reading before end-of-file
104 and want at least one byte, but the starting position is past
105 the maximum offset for this file.
106 .SH "CONFORMING TO"
107 POSIX.1-2001.
108 .SH NOTES
109 It is a good idea to zero out the control block before use.
110 This control block must not be changed while the read operation
111 is in progress.
112 The buffer area being read into
113 .\" or the control block of the operation
114 must not be accessed during the operation or undefined results may
115 occur.
116 The memory areas involved must remain valid.
117 .SH "SEE ALSO"
118 .BR aio_cancel (3),
119 .BR aio_error (3),
120 .BR aio_fsync (3),
121 .BR aio_return (3),
122 .BR aio_suspend (3),
123 .BR aio_write (3)