AIO_CANCEL(2)

✨ AIO_CANCEL πŸ’… β€” the aio_cancel system call, from the System Calls Manual

okay bestie, buckle up πŸŽ€ this is aio_cancel(2), and it's here to ✨ cancel an outstanding asynchronous I/O operation (REALTIME) ✨. yes, REALTIME. that's the vibe.

πŸ“š LIBRARY

Standard C Library (libc, -lc) 🫢


🌸 SYNOPSIS

#include <aio.h>

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

πŸ’– DESCRIPTION

so the aio_cancel() system call does exactly what it says on the tin, no cap: it cancels the outstanding asynchronous I/O request for the file descriptor you passed in as fildes. iconic behaviour, honestly.

and if you also hand it an iocb? then it's picky β€” only that specific asynchronous I/O request gets cancelled. main character energy, it knows what it wants. πŸ‘‘

Normal asynchronous notification occurs for cancelled requests β€” so like, the notification system still does its thing, don't worry. and those requests complete with an error result of ECANCELED. so yeah, they end, but they end sad. 😭


🚧 RESTRICTIONS

okay lowkey important, listen up:

The aio_cancel() system call does not cancel asynchronous I/O requests for raw disk devices. nope. not happening. not today. πŸ™ˆ

The aio_cancel() system call will always return AIO_NOTCANCELED for file descriptors associated with raw disk devices. always. every single time. it's giving "we said no."


🌈 RETURN VALUES

The aio_cancel() system call returns -1 to indicate an error, or one of the following:

  • [AIO_CANCELED] β€” all outstanding requests meeting the criteria specified were cancelled. slay, we ate. πŸ’…βœ¨
  • [AIO_NOTCANCELED] β€” some requests were not cancelled, status for the requests should be checked with aio_error(2). so go check, bestie, don't just sit there 🫢
  • [AIO_ALLDONE] β€” all of the requests meeting the criteria have finished. like, they were already done before you even asked. awkward but okay πŸ’€

πŸ’€ ERRORS

An error return from aio_cancel() indicates:

  • [EBADF] β€” the fildes argument is an invalid file descriptor. bestie that fd is not real, that fd is a ghost πŸ‘»

πŸ”— SEE ALSO

aio_error(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), aio(4) β€” the whole friend group, go read them all πŸŽ€


πŸ“ STANDARDS

The aio_cancel() system call is expected to conform to the IEEE Std 1003.1 (β€œPOSIX.1”) standard. certified, official, legit, no cap. ⭐


πŸ¦‹ HISTORY

The aio_cancel() system call first appeared in FreeBSD 3.0. The first functional implementation of aio_cancel() appeared in FreeBSD 4.0. so like, it existed, then it actually existed. character development. 🌸


πŸ‘‘ AUTHORS

This manual page was originally written by Wes Peters <wes@softweyr.com>. Christopher M Sedore <cmsedore@maxwell.syr.edu> updated it when aio_cancel() was implemented for FreeBSD 4.0. legends, both of them, we stan πŸ’œ


and that's the whole page, bestie!! this one's from the Debian crew, dated January 19, 2000, and it lives in section 2 of the manual (AIO_CANCEL(2)). go cancel something (responsibly) πŸ’–βœ¨

πŸ“¦ where this page comes from