| 1 |
.\" Copyright 2003, Free Software Foundation, Inc. |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 5 |
.\" |
| 6 |
.TH io_cancel 2 2026-04-11 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
io_cancel \- cancel an outstanding asynchronous I/O operation |
| 9 |
.SH LIBRARY |
| 10 |
Standard C library |
| 11 |
.RI ( libc ,\~ \-lc ) |
| 12 |
.SH SYNOPSIS |
| 13 |
.nf |
| 14 |
.BR "#include <linux/aio_abi.h>" " /* Definition of needed types */" |
| 15 |
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */" |
| 16 |
.B #include <unistd.h> |
| 17 |
.P |
| 18 |
.BI "int syscall(SYS_io_cancel, aio_context_t " ctx_id ", struct iocb *" iocb , |
| 19 |
.BI " struct io_event *" result ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
.IR Note : |
| 23 |
you probably want to use the |
| 24 |
.BR io_getevents (3) |
| 25 |
wrapper function provided by |
| 26 |
.IR libaio ; |
| 27 |
see VERSIONS. |
| 28 |
.P |
| 29 |
The |
| 30 |
.BR io_cancel () |
| 31 |
system call |
| 32 |
attempts to cancel an asynchronous I/O operation previously submitted with |
| 33 |
.BR io_submit (2). |
| 34 |
The |
| 35 |
.I iocb |
| 36 |
argument describes the operation to be canceled and the |
| 37 |
.I ctx_id |
| 38 |
argument is the AIO context to which the operation was submitted. |
| 39 |
If the operation is successfully canceled, the event will be copied into |
| 40 |
the memory pointed to by |
| 41 |
.I result |
| 42 |
without being placed into the |
| 43 |
completion queue. |
| 44 |
.SH RETURN VALUE |
| 45 |
On success, |
| 46 |
.BR io_cancel () |
| 47 |
returns 0. |
| 48 |
On error, |
| 49 |
\-1 is returned, |
| 50 |
and |
| 51 |
.I errno |
| 52 |
is set to indicate the error. |
| 53 |
.SH ERRORS |
| 54 |
.TP |
| 55 |
.B EAGAIN |
| 56 |
The |
| 57 |
.I iocb |
| 58 |
specified was not canceled. |
| 59 |
.TP |
| 60 |
.B EFAULT |
| 61 |
One of the data structures points to invalid data. |
| 62 |
.TP |
| 63 |
.B EINVAL |
| 64 |
The AIO context specified by |
| 65 |
.I ctx_id |
| 66 |
is invalid. |
| 67 |
.TP |
| 68 |
.B ENOSYS |
| 69 |
.BR io_cancel () |
| 70 |
is not implemented on this architecture. |
| 71 |
.SH VERSIONS |
| 72 |
.UR https://pagure.io/libaio |
| 73 |
.I libaio |
| 74 |
.UE |
| 75 |
provides a wrapper function with the same name, |
| 76 |
but different prototype and return value. |
| 77 |
You probably want to use that wrapper. |
| 78 |
.SH STANDARDS |
| 79 |
Linux. |
| 80 |
.SH HISTORY |
| 81 |
Linux 2.5. |
| 82 |
.SH SEE ALSO |
| 83 |
.BR io_destroy (2), |
| 84 |
.BR io_getevents (2), |
| 85 |
.BR io_setup (2), |
| 86 |
.BR io_submit (2), |
| 87 |
.BR io_cancel (3), |
| 88 |
.BR aio (7) |
| 89 |
.\" .SH AUTHOR |
| 90 |
.\" Kent Yoder. |