man-pages/man2/io_cancel.2.html
2021-03-31 01:06:50 +01:00

191 lines
4.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of IO_CANCEL</TITLE>
</HEAD><BODY>
<H1>IO_CANCEL</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">&nbsp;</A>
<H2>NAME</H2>
io_cancel - cancel an outstanding asynchronous I/O operation
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
<B>#include &lt;<A HREF="file:///usr/include/linux/aio_abi.h">linux/aio_abi.h</A>&gt;</B> /* Defines needed types */
<B>int io_cancel(aio_context_t </B><I>ctx_id</I><B>, struct iocb *</B><I>iocb</I><B>,</B>
<B> struct io_event *</B><I>result</I><B>);</B>
</PRE>
<P>
<I>Note</I>:
There is no glibc wrapper for this system call; see NOTES.
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
The
<B>io_cancel</B>()
system call
attempts to cancel an asynchronous I/O operation previously submitted with
<B><A HREF="/cgi-bin/man/man2html?2+io_submit">io_submit</A></B>(2).
The
<I>iocb</I>
argument describes the operation to be canceled and the
<I>ctx_id</I>
argument is the AIO context to which the operation was submitted.
If the operation is successfully canceled, the event will be copied into
the memory pointed to by
<I>result</I>
without being placed into the
completion queue.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success,
<B>io_cancel</B>()
returns 0.
For the failure return, see NOTES.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EAGAIN</B>
<DD>
The <I>iocb</I> specified was not canceled.
<DT id="2"><B>EFAULT</B>
<DD>
One of the data structures points to invalid data.
<DT id="3"><B>EINVAL</B>
<DD>
The AIO context specified by <I>ctx_id</I> is invalid.
<DT id="4"><B>ENOSYS</B>
<DD>
<B>io_cancel</B>()
is not implemented on this architecture.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>VERSIONS</H2>
<P>
The asynchronous I/O system calls first appeared in Linux 2.5.
<A NAME="lbAH">&nbsp;</A>
<H2>CONFORMING TO</H2>
<P>
<B>io_cancel</B>()
is Linux-specific and should not be used
in programs that are intended to be portable.
<A NAME="lbAI">&nbsp;</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_cancel</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">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+io_destroy">io_destroy</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+io_getevents">io_getevents</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)
<A NAME="lbAK">&nbsp;</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">&nbsp;</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">SEE ALSO</A><DD>
<DT id="14"><A HREF="#lbAK">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>