io_cancel(2) System Calls Manual io_cancel(2) NAME io_cancel - cancel an outstanding asynchronous I/O operation LIBRARY Standard C library (libc, -lc) SYNOPSIS #include /* Definition of needed types */ #include /* Definition of SYS_* constants */ #include int syscall(SYS_io_cancel, aio_context_t ctx_id, struct iocb *iocb, struct io_event *result); DESCRIPTION Note: you probably want to use the io_getevents(3) wrapper function provided by libaio; see VERSIONS. The io_cancel() system call attempts to cancel an asynchronous I/O operation previously submitted with io_submit(2). The iocb argument describes the operation to be canceled and the 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 result without being placed into the completion queue. RETURN VALUE On success, io_cancel() returns 0. On error, -1 is returned, and errno is set to indicate the error. ERRORS EAGAIN The iocb specified was not canceled. EFAULT One of the data structures points to invalid data. EINVAL The AIO context specified by ctx_id is invalid. ENOSYS io_cancel() is not implemented on this architecture. VERSIONS libaio provides a wrapper function with the same name, but different prototype and return value. You probably want to use that wrapper. STANDARDS Linux. HISTORY Linux 2.5. SEE ALSO io_destroy(2), io_getevents(2), io_setup(2), io_submit(2), io_cancel(3), aio(7) Linux man-pages 6.19 2026-04-11 io_cancel(2)