'\" t .\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .TH aio_cancel 3 2023-03-30 "Linux man-pages 6.04" .SH NAME aio_cancel \- cancel an outstanding asynchronous I/O request .SH LIBRARY Real-time library .RI ( librt ", " \-lrt ) .SH SYNOPSIS .nf .B "#include " .PP .BI "int aio_cancel(int " fd ", struct aiocb *" aiocbp ); .fi .SH DESCRIPTION The .BR aio_cancel () function attempts to cancel outstanding asynchronous I/O requests for the file descriptor .IR fd . If .I aiocbp is NULL, all such requests are canceled. Otherwise, only the request described by the control block pointed to by .I aiocbp is canceled. (See .BR aio (7) for a description of the .I aiocb structure.) .PP Normal asynchronous notification occurs for canceled requests (see .BR aio (7) and .BR sigevent (7)). The request return status .RB ( aio_return (3)) is set to \-1, and the request error status .RB ( aio_error (3)) is set to .BR ECANCELED . The control block of requests that cannot be canceled is not changed. .PP If the request could not be canceled, then it will terminate in the usual way after performing the I/O operation. (In this case, .BR aio_error (3) will return the status .BR EINPROGRESSS .) .PP If .I aiocbp is not NULL, and .I fd differs from the file descriptor with which the asynchronous operation was initiated, unspecified results occur. .PP Which operations are cancelable is implementation-defined. .\" FreeBSD: not those on raw disk devices. .SH RETURN VALUE The .BR aio_cancel () function returns one of the following values: .TP .B AIO_CANCELED All requests were successfully canceled. .TP .B AIO_NOTCANCELED At least one of the requests specified was not canceled because it was in progress. In this case, one may check the status of individual requests using .BR aio_error (3). .TP .B AIO_ALLDONE All requests had already been completed before the call. .TP \-1 An error occurred. The cause of the error can be found by inspecting .IR errno . .SH ERRORS .TP .B EBADF .I fd is not a valid file descriptor. .TP .B ENOSYS .BR aio_cancel () is not implemented. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .ad l .nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .BR aio_cancel () T} Thread safety MT-Safe .TE .hy .ad .sp 1 .SH STANDARDS POSIX.1-2008. .SH HISTORY glibc 2.1. POSIX.1-2001. .SH EXAMPLES See .BR aio (7). .SH SEE ALSO .BR aio_error (3), .BR aio_fsync (3), .BR aio_read (3), .BR aio_return (3), .BR aio_suspend (3), .BR aio_write (3), .BR lio_listio (3), .BR aio (7)