AIO_CANCEL(3POSIX)

๐Ÿซถ aio_cancel ๐Ÿซถ

okay so bestie, welcome to aio_cancel ๐Ÿ’… this page comes straight outta the POSIX Programmer's Manual, section 3POSIX, and it's literally all about canceling asynchronous I/O requests. grab a snack, we're doing this ๐ŸŒธ


โœจ PROLOG โœจ

first things first, the fine print that we do not skip: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ โ€” so consult the corresponding Linux manual page for the details on Linux behavior, fr fr. orโ€ฆ the interface may not be implemented on Linux at all ๐Ÿ’€ so vibe check before you commit, bestie.


๐ŸŽ€ NAME ๐ŸŽ€

aio_cancel โ€” cancel an asynchronous I/O request. that's it, that's the whole thing, iconic ๐Ÿ‘‘


๐Ÿ’… SYNOPSIS ๐Ÿ’…

#include <aio.h>

int aio_cancel(int fildes, struct aiocb *aiocbp);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so here's the tea ๐Ÿ“ the aio_cancel() function shall attempt to cancel one or more asynchronous I/O requests that are currently outstanding against the file descriptor fildes. note the word attempt, bestie โ€” it's giving "we'll try" not "we'll guarantee" ๐Ÿ˜ญ

the aiocbp argument points to the asynchronous I/O control block for one particular request that you want canceled. and if aiocbp is NULL? then all outstanding cancelable asynchronous I/O requests against fildes shall be canceled. we're going full scorched earth, no survivors ๐Ÿ”ฅ

normal asynchronous notification shall occur for the asynchronous I/O operations that get successfully canceled. and if there are requests that cannot be canceled? then the normal asynchronous completion process shall take place for those requests when they are completed. they finish their little journey, we just don't get to stop it ๐Ÿงš

for requested operations that are successfully canceled, the associated error status shall be set to [ECANCELED] and the return status shall be -1. for requested operations that are not successfully canceled, the aiocbp shall not be modified by aio_cancel(). hands off, no touchy ๐Ÿ™ˆ

now, if aiocbp is not NULL, and fildes does not have the same value as the file descriptor with which the asynchronous operation was initiated โ€” unspecified results occur. that's the scary sentence. that's the one where the standard just shrugs at you ๐Ÿ’€ don't do that.

and the big one: which operations are cancelable is implementation-defined. so it depends on your implementation, periodt.


๐ŸŒˆ RETURN VALUE ๐ŸŒˆ

here's what you get back, bestie:

  • AIO_CANCELED โ€” the requested operation(s) were canceled. slay ๐ŸŽ‰
  • AIO_NOTCANCELED โ€” returned if at least one of the requested operation(s) cannot be canceled because it is in progress. and no, the state of the other operations (if any) referenced in the call to aio_cancel() is not indicated by the return value of aio_cancel(). rude, honestly. the application may determine the state of affairs for these operations by using aio_error(). so like, ask the other function, iykyk.
  • AIO_ALLDONE โ€” returned if all of the operations have already completed. nothing left to cancel, it's over, the girls have gone home ๐Ÿ’œ
  • otherwise, the function shall return -1 and set errno to indicate the error.

๐Ÿšจ ERRORS ๐Ÿšจ

the aio_cancel() function shall fail if:

  • EBADF โ€” the fildes argument is not a valid file descriptor. like bestie, that's not a real file descriptor, please ๐Ÿ˜ญ
heads up: the following sections are informative. (that's what the standard says, we're just relaying the message ๐Ÿ’Œ)

๐ŸŒธ EXAMPLES ๐ŸŒธ

None. literally nothing here, bestie ๐Ÿ™ˆ


๐ŸŽ€ APPLICATION USAGE ๐ŸŽ€

None. again, nothing. the page is being mysterious โœจ


๐Ÿง  RATIONALE ๐Ÿง 

None. no thoughts, head empty ๐Ÿ’ญ


๐Ÿ”ฎ FUTURE DIRECTIONS ๐Ÿ”ฎ

None. the future is unwritten, queen ๐Ÿ‘‘


๐Ÿซถ SEE ALSO ๐Ÿซถ

  • aio_read()
  • aio_write()
  • The Base Definitions volume of POSIX.1โ€2017, <aio.h>

Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


okay that's the whole page, bestie, we ate and left no crumbs ๐Ÿ’… this came to you courtesy of IEEE/The Open Group, 2017, and the page itself is AIO_CANCEL(3POSIX) โ€” go cancel something (safely), mwah ๐Ÿฉทโœจ

๐Ÿ“ฆ where this page comes from