| 1 |
'\" t |
| 2 |
.\" Copyright 2003, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
.\" |
| 7 |
.TH aio_cancel 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
aio_cancel \- cancel an outstanding asynchronous I/O request |
| 10 |
.SH LIBRARY |
| 11 |
Real-time library |
| 12 |
.RI ( librt ,\~ \-lrt ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B "#include <aio.h>" |
| 16 |
.P |
| 17 |
.BI "int aio_cancel(int " fd ", struct aiocb *" aiocbp ); |
| 18 |
.fi |
| 19 |
.SH DESCRIPTION |
| 20 |
The |
| 21 |
.BR aio_cancel () |
| 22 |
function attempts to cancel outstanding asynchronous I/O requests |
| 23 |
for the file descriptor |
| 24 |
.IR fd . |
| 25 |
If |
| 26 |
.I aiocbp |
| 27 |
is NULL, all such requests are canceled. |
| 28 |
Otherwise, only the request |
| 29 |
described by the control block pointed to by |
| 30 |
.I aiocbp |
| 31 |
is canceled. |
| 32 |
(See |
| 33 |
.BR aio (7) |
| 34 |
for a description of the |
| 35 |
.I aiocb |
| 36 |
structure.) |
| 37 |
.P |
| 38 |
Normal asynchronous notification occurs for canceled requests (see |
| 39 |
.BR aio (7) |
| 40 |
and |
| 41 |
.BR sigevent (3type)). |
| 42 |
The request return status |
| 43 |
.RB ( aio_return (3)) |
| 44 |
is set to \-1, and the request error status |
| 45 |
.RB ( aio_error (3)) |
| 46 |
is set to |
| 47 |
.BR ECANCELED . |
| 48 |
The control block of requests that cannot be canceled is not changed. |
| 49 |
.P |
| 50 |
If the request could not be canceled, |
| 51 |
then it will terminate in the usual way after performing the I/O operation. |
| 52 |
(In this case, |
| 53 |
.BR aio_error (3) |
| 54 |
will return the status |
| 55 |
.BR EINPROGRESSS .) |
| 56 |
.P |
| 57 |
If |
| 58 |
.I aiocbp |
| 59 |
is not NULL, and |
| 60 |
.I fd |
| 61 |
differs from the file descriptor with which the asynchronous operation |
| 62 |
was initiated, unspecified results occur. |
| 63 |
.P |
| 64 |
Which operations are cancelable is implementation-defined. |
| 65 |
.\" FreeBSD: not those on raw disk devices. |
| 66 |
.SH RETURN VALUE |
| 67 |
The |
| 68 |
.BR aio_cancel () |
| 69 |
function returns one of the following values: |
| 70 |
.TP |
| 71 |
.B AIO_CANCELED |
| 72 |
All requests were successfully canceled. |
| 73 |
.TP |
| 74 |
.B AIO_NOTCANCELED |
| 75 |
At least one of the |
| 76 |
requests specified was not canceled because it was in progress. |
| 77 |
In this case, one may check the status of individual requests using |
| 78 |
.BR aio_error (3). |
| 79 |
.TP |
| 80 |
.B AIO_ALLDONE |
| 81 |
All requests had already been completed before the call. |
| 82 |
.TP |
| 83 |
\-1 |
| 84 |
An error occurred. |
| 85 |
The error can be found by inspecting |
| 86 |
.IR errno . |
| 87 |
.SH ERRORS |
| 88 |
.TP |
| 89 |
.B EBADF |
| 90 |
.I fd |
| 91 |
is not a valid file descriptor. |
| 92 |
.TP |
| 93 |
.B ENOSYS |
| 94 |
.BR aio_cancel () |
| 95 |
is not implemented. |
| 96 |
.SH ATTRIBUTES |
| 97 |
For an explanation of the terms used in this section, see |
| 98 |
.BR attributes (7). |
| 99 |
.TS |
| 100 |
allbox; |
| 101 |
lbx lb lb |
| 102 |
l l l. |
| 103 |
Interface Attribute Value |
| 104 |
T{ |
| 105 |
.na |
| 106 |
.nh |
| 107 |
.BR aio_cancel () |
| 108 |
T} Thread safety MT-Safe |
| 109 |
.TE |
| 110 |
.SH STANDARDS |
| 111 |
POSIX.1-2008. |
| 112 |
.SH HISTORY |
| 113 |
glibc 2.1. |
| 114 |
POSIX.1-2001. |
| 115 |
.SH EXAMPLES |
| 116 |
See |
| 117 |
.BR aio (7). |
| 118 |
.SH SEE ALSO |
| 119 |
.BR aio_error (3), |
| 120 |
.BR aio_fsync (3), |
| 121 |
.BR aio_read (3), |
| 122 |
.BR aio_return (3), |
| 123 |
.BR aio_suspend (3), |
| 124 |
.BR aio_write (3), |
| 125 |
.BR lio_listio (3), |
| 126 |
.BR aio (7) |