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 2021-03-22 "Linux" "Linux Programmer's Manual"
9 io_getevents \- read asynchronous I/O events from the completion queue
12 .BR "#include <linux/aio_abi.h>" " /* Definition of " *io_* " types */"
13 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
14 .B #include <unistd.h>
16 .BI "int syscall(SYS_io_getevents, aio_context_t " ctx_id ,
17 .BI " long " min_nr ", long " nr ", struct io_event *" events ,
18 .BI " struct timespec *" timeout );
22 glibc provides no wrapper for
24 necessitating the use of
28 this page describes the raw Linux system call interface.
29 The wrapper function provided by
31 uses a different type for the
39 attempts to read at least \fImin_nr\fP events and
40 up to \fInr\fP events from the completion queue of the AIO context
41 specified by \fIctx_id\fP.
43 The \fItimeout\fP argument specifies the amount of time to wait for events,
44 and is specified as a relative timeout in a structure of the following form:
49 time_t tv_sec; /* seconds */
50 long tv_nsec; /* nanoseconds [0 .. 999999999] */
55 The specified time will be rounded up to the system clock granularity
56 and is guaranteed not to expire early.
60 as NULL means block indefinitely until at least
62 events have been obtained.
66 returns the number of events read.
67 This may be 0, or a value less than
72 It may also be a nonzero value less than
74 if the call was interrupted by a signal handler.
76 For the failure return, see NOTES.
80 Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
83 Interrupted by a signal handler; see
87 \fIctx_id\fP is invalid.
88 \fImin_nr\fP is out of range or \fInr\fP is
93 is not implemented on this architecture.
95 The asynchronous I/O system calls first appeared in Linux 2.5.
98 is Linux-specific and should not be used in
99 programs that are intended to be portable.
101 You probably want to use the
103 wrapper function provided by
104 .\" http://git.fedorahosted.org/git/?p=libaio.git
109 wrapper function uses a different type
111 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
118 wrapper does not follow the usual C library conventions for indicating errors:
119 on error it returns a negated error number
120 (the negative of one of the values listed in ERRORS).
121 If the system call is invoked via
123 then the return value follows the usual conventions for
124 indicating an error: \-1, with
126 set to a (positive) value that indicates the error.
130 may cause a segmentation fault instead of generating the error