1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" This file is distributed according to the GNU General Public License.
7 .TH IO_GETEVENTS 2 2016-10-08 "Linux" "Linux Programmer's Manual"
9 io_getevents \- read asynchronous I/O events from the completion queue
12 .BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
13 .BR "#include <linux/time.h>" " /* Defines 'struct timespec' */"
15 .BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
16 .BI " struct io_event *" events \
17 ", struct timespec *" timeout );
21 There is no glibc wrapper for this system call; see NOTES.
27 attempts to read at least \fImin_nr\fP events and
28 up to \fInr\fP events from the completion queue of the AIO context
29 specified by \fIctx_id\fP.
31 The \fItimeout\fP argument specifies the amount of time to wait for events,
32 and is specified as a relative timeout in a structure of the following form:
37 time_t tv_sec; /* seconds */
38 long tv_nsec; /* nanoseconds [0 .. 999999999] */
43 The specified time will be rounded up to the system clock granularity
44 and is guaranteed not to expire early.
48 as NULL means block indefinitely until at least
50 events have been obtained.
54 returns the number of events read.
55 This may be 0, or a value less than
60 It may also be a nonzero value less than
62 if the call was interrupted by a signal handler.
64 For the failure return, see NOTES.
68 Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
71 Interrupted by a signal handler; see
75 \fIctx_id\fP is invalid.
76 \fImin_nr\fP is out of range or \fInr\fP is
81 is not implemented on this architecture.
84 The asynchronous I/O system calls first appeared in Linux 2.5.
88 is Linux-specific and should not be used in
89 programs that are intended to be portable.
91 Glibc does not provide a wrapper function for this system call.
92 You could invoke it using
94 But instead, you probably want to use the
96 wrapper function provided by
97 .\" http://git.fedorahosted.org/git/?p=libaio.git
102 wrapper function uses a different type
104 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
111 wrapper does not follow the usual C library conventions for indicating errors:
112 on error it returns a negated error number
113 (the negative of one of the values listed in ERRORS).
114 If the system call is invoked via
116 then the return value follows the usual conventions for
117 indicating an error: \-1, with
119 set to a (positive) value that indicates the error.
123 may cause a segmentation fault instead of generating the error