1 .\" Copyright (C) 2003 Free Software Foundation, Inc.
2 .\" This file is distributed according to the GNU General Public License.
3 .\" See the file COPYING in the top level source directory for details.
5 .TH IO_GETEVENTS 2 2012-05-08 "Linux" "Linux Programmer's Manual"
7 io_getevents \- read asynchronous I/O events from the completion queue
10 .BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
11 .BR "#include <linux/time.h>" " /* Defines 'struct timespec' */"
14 .BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
15 .BI " struct io_event *" events \
16 ", struct timespec *" timeout );
23 attempts to read at least \fImin_nr\fP events and
24 up to \fInr\fP events from the completion queue of the AIO context
25 specified by \fIctx_id\fP.
26 The \fItimeout\fP argument specifies the amount of time to wait for events,
27 where a NULL timeout waits until at least \fImin_nr\fP events
29 Note that \fItimeout\fP is relative and will be updated if not NULL
30 and the operation blocks.
34 returns the number of events read: 0 if no events are
35 available, or less than \fImin_nr\fP if the \fItimeout\fP has elapsed.
36 For the failure return, see NOTES.
40 Either \fIevents\fP or \fItimeout\fP is an invalid pointer.
43 \fIctx_id\fP is invalid.
44 \fImin_nr\fP is out of range or \fInr\fP is
48 Interrupted by a signal handler; see
53 is not implemented on this architecture.
56 The asynchronous I/O system calls first appeared in Linux 2.5.
60 is Linux-specific and should not be used in
61 programs that are intended to be portable.
63 Glibc does not provide a wrapper function for this system call.
64 You could invoke it using
66 But instead, you probably want to use the
68 wrapper function provided by
69 .\" http://git.fedorahosted.org/git/?p=libaio.git
74 wrapper function uses a different type
76 .\" But glibc is confused, since <libaio.h> uses 'io_context_t' to declare
83 wrapper does not follow the usual C library conventions for indicating errors:
84 on error it returns a negated error number
85 (the negative of one of the values listed in ERRORS).
86 If the system call is invoked via
88 then the return value follows the usual conventions for
89 indicating an error: \-1, with
91 set to a (positive) value that indicates the error.