.\" Copyright 2003, Free Software Foundation, Inc. .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: GPL-1.0-or-later .\" .TH io_cancel 2 2026-04-11 "Linux man-pages 6.18" .SH NAME io_cancel \- cancel an outstanding asynchronous I/O operation .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#include " " /* Definition of needed types */" .BR "#include " " /* Definition of " SYS_* " constants */" .B #include .P .BI "int syscall(SYS_io_cancel, aio_context_t " ctx_id ", struct iocb *" iocb , .BI " struct io_event *" result ); .fi .SH DESCRIPTION .IR Note : you probably want to use the .BR io_getevents (3) wrapper function provided by .IR libaio ; see VERSIONS. .P The .BR io_cancel () system call attempts to cancel an asynchronous I/O operation previously submitted with .BR io_submit (2). The .I iocb argument describes the operation to be canceled and the .I ctx_id 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 without being placed into the completion queue. .SH RETURN VALUE On success, .BR io_cancel () returns 0. On error, \-1 is returned, and .I errno is set to indicate the error. .SH ERRORS .TP .B EAGAIN The .I iocb specified was not canceled. .TP .B EFAULT One of the data structures points to invalid data. .TP .B EINVAL The AIO context specified by .I ctx_id is invalid. .TP .B ENOSYS .BR io_cancel () is not implemented on this architecture. .SH VERSIONS .UR https://pagure.io/libaio .I libaio .UE provides a wrapper function with the same name, but different prototype and return value. You probably want to use that wrapper. .SH STANDARDS Linux. .SH HISTORY Linux 2.5. .SH SEE ALSO .BR io_destroy (2), .BR io_getevents (2), .BR io_setup (2), .BR io_submit (2), .BR io_cancel (3), .BR aio (7) .\" .SH AUTHOR .\" Kent Yoder.