1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
3 .\" SPDX-License-Identifier: GPL-1.0-or-later
5 .TH IO_GETEVENTS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
7 io_getevents \- read asynchronous I/O events from the completion queue
10 .RI ( libc ", " \-lc )
13 .BR "#include <linux/aio_abi.h>" " /* Definition of " *io_* " types */"
14 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
15 .B #include <unistd.h>
17 .BI "int syscall(SYS_io_getevents, aio_context_t " ctx_id ,
18 .BI " long " min_nr ", long " nr ", struct io_event *" events ,
19 .BI " struct timespec *" timeout );
23 glibc provides no wrapper for
25 necessitating the use of
29 this page describes the raw Linux system call interface.
30 The wrapper function provided by
32 uses a different type for the
40 attempts to read at least \fImin_nr\fP events and
41 up to \fInr\fP events from the completion queue of the AIO context
42 specified by \fIctx_id\fP.
44 The \fItimeout\fP argument specifies the amount of time to wait for events,
45 and is specified as a relative timeout in a
49 The specified time will be rounded up to the system clock granularity
50 and is guaranteed not to expire early.
54 as NULL means block indefinitely until at least
56 events have been obtained.
60 returns the number of events read.
61 This may be 0, or a value less than
66 It may also be a nonzero value less than
68 if the call was interrupted by a signal handler.
70 For the failure return, see NOTES.
74 Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
77 Interrupted by a signal handler; see
81 \fIctx_id\fP is invalid.
82 \fImin_nr\fP is out of range or \fInr\fP is
87 is not implemented on this architecture.
89 The asynchronous I/O system calls first appeared in Linux 2.5.
92 is Linux-specific and should not be used in
93 programs that are intended to be portable.
95 You probably want to use the
97 wrapper function provided by
98 .\" http://git.fedorahosted.org/git/?p=libaio.git
103 wrapper function uses a different type
105 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
112 wrapper does not follow the usual C library conventions for indicating errors:
113 on error it returns a negated error number
114 (the negative of one of the values listed in ERRORS).
115 If the system call is invoked via
117 then the return value follows the usual conventions for
118 indicating an error: \-1, with
120 set to a (positive) value that indicates the error.
124 may cause a segmentation fault instead of generating the error