237 lines
5.5 KiB
HTML
237 lines
5.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of IO_GETEVENTS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>IO_GETEVENTS</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
io_getevents - read asynchronous I/O events from the completion queue
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/linux/aio_abi.h">linux/aio_abi.h</A>></B> /* Defines needed types */
|
|
<B>#include <<A HREF="file:///usr/include/linux/time.h">linux/time.h</A>></B> /* Defines 'struct timespec' */
|
|
|
|
<B>int io_getevents(aio_context_t </B><I>ctx_id</I><B>, long </B><I>min_nr</I><B>, long </B><I>nr</I><B>,</B>
|
|
<B> struct io_event *</B><I>events</I><B>, struct timespec *</B><I>timeout</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
<I>Note</I>:
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
The
|
|
<B>io_getevents</B>()
|
|
|
|
system call
|
|
attempts to read at least <I>min_nr</I> events and
|
|
up to <I>nr</I> events from the completion queue of the AIO context
|
|
specified by <I>ctx_id</I>.
|
|
<P>
|
|
|
|
The <I>timeout</I> argument specifies the amount of time to wait for events,
|
|
and is specified as a relative timeout in a structure of the following form:
|
|
<P>
|
|
|
|
|
|
|
|
struct timespec {
|
|
<BR> time_t tv_sec; /* seconds */
|
|
<BR> long tv_nsec; /* nanoseconds [0 .. 999999999] */
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
The specified time will be rounded up to the system clock granularity
|
|
and is guaranteed not to expire early.
|
|
<P>
|
|
|
|
Specifying
|
|
<I>timeout</I>
|
|
|
|
as NULL means block indefinitely until at least
|
|
<I>min_nr</I>
|
|
|
|
events have been obtained.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>io_getevents</B>()
|
|
|
|
returns the number of events read.
|
|
This may be 0, or a value less than
|
|
<I>min_nr</I>,
|
|
|
|
if the
|
|
<I>timeout</I>
|
|
|
|
expired.
|
|
It may also be a nonzero value less than
|
|
<I>min_nr</I>,
|
|
|
|
if the call was interrupted by a signal handler.
|
|
<P>
|
|
|
|
For the failure return, see NOTES.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
Either <I>events</I> or <I>timeout</I> is an invalid pointer.
|
|
<DT id="2"><B>EINTR</B>
|
|
|
|
<DD>
|
|
Interrupted by a signal handler; see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7).
|
|
|
|
<DT id="3"><B>EINVAL</B>
|
|
|
|
<DD>
|
|
<I>ctx_id</I> is invalid.
|
|
<I>min_nr</I> is out of range or <I>nr</I> is
|
|
out of range.
|
|
<DT id="4"><B>ENOSYS</B>
|
|
|
|
<DD>
|
|
<B>io_getevents</B>()
|
|
|
|
is not implemented on this architecture.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
<P>
|
|
|
|
The asynchronous I/O system calls first appeared in Linux 2.5.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<P>
|
|
|
|
<B>io_getevents</B>()
|
|
|
|
is Linux-specific and should not be used in
|
|
programs that are intended to be portable.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
Glibc does not provide a wrapper function for this system call.
|
|
You could invoke it using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2).
|
|
|
|
But instead, you probably want to use the
|
|
<B>io_getevents</B>()
|
|
|
|
wrapper function provided by
|
|
|
|
<I>libaio</I>.
|
|
|
|
<P>
|
|
|
|
Note that the
|
|
<I>libaio</I>
|
|
|
|
wrapper function uses a different type
|
|
(<I>io_context_t</I>)
|
|
|
|
|
|
|
|
for the
|
|
<I>ctx_id</I>
|
|
|
|
argument.
|
|
Note also that the
|
|
<I>libaio</I>
|
|
|
|
wrapper does not follow the usual C library conventions for indicating errors:
|
|
on error it returns a negated error number
|
|
(the negative of one of the values listed in ERRORS).
|
|
If the system call is invoked via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2),
|
|
|
|
then the return value follows the usual conventions for
|
|
indicating an error: -1, with
|
|
<I>errno</I>
|
|
|
|
set to a (positive) value that indicates the error.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
An invalid
|
|
<I>ctx_id</I>
|
|
|
|
may cause a segmentation fault instead of generating the error
|
|
<B>EINVAL</B>.
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_cancel">io_cancel</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_destroy">io_destroy</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_setup">io_setup</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_submit">io_submit</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+aio">aio</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+time">time</A></B>(7)
|
|
|
|
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="9"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="10"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="11"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="12"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="13"><A HREF="#lbAJ">BUGS</A><DD>
|
|
<DT id="14"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="15"><A HREF="#lbAL">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:33 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|