AIO_WAITCOMPLETE(2)
π aio_waitcomplete β the "bestie, is my async I/O done yet??" syscall
okay so this is from the System Calls Manual, section 2 (that's the syscall girlies π
). It lives in aio_waitcomplete(2) and it's about to become your new hyperfixation, no cap.
β¨ NAME β¨
aio_waitcomplete β wait for the next completion of an aio request
like literally, it sits there and waits for one (1) async I/O request to finish. that's the whole vibe.
π LIBRARY π
Standard C Library (libc, -lc)
link it, love it, it's free π«Ά
πΈ SYNOPSIS πΈ
#include <aio.h>
ssize_t
aio_waitcomplete(struct aiocb **iocbp, struct timespec *timeout);
π¦ DESCRIPTION π¦
The aio_waitcomplete() system call waits for completion of an asynchronous I/O request. When it's done, aio_waitcomplete() returns the result of the function and sets iocbp to point to the structure associated with the original request. And if an asynchronous I/O request already finished before you even called aio_waitcomplete()? It returns immediately with that completed request. no waiting, instant slay β¨
If timeout is a non-NULL pointer, it specifies a maximum interval to wait for a asynchronous I/O request to complete. If timeout is a NULL pointer, aio_waitcomplete() waits indefinitely β like, forever-forever, main character patience π§
To effect a poll, the timeout argument should be non-NULL, pointing to a zero-valued timeval structure. so basically: "do u have anything for me rn or not, no pressure" π
ok this part is important bestie, don't skip it: Theaio_waitcomplete()system call also serves the function ofaio_return(), thusaio_return()should not be called for the control block returned iniocbp. it's giving two-for-one, but also it's giving "do NOT double-dip, I am warning u" π
π₯ RETURN VALUES π₯
If an asynchronous I/O request has completed, iocbp is set to point to the control block passed with the original request, and the status is returned as described in read(2), write(2), or fsync(2). iconic behaviour, honestly π
On failure, aio_waitcomplete() returns -1, sets iocbp to NULL and sets errno to indicate the error condition. yeah... it's not beating the failure allegations π
π ERRORS π
The aio_waitcomplete() system call fails if:
[EINVAL]β The specified time limit is invalid. girl what kind of time is that π[EAGAIN]β The process has not yet calledaio_read()oraio_write(). you showed up to the party with no I/O queued, embarrassing fr fr π[EINTR]β A signal was delivered before the timeout expired and before any asynchronous I/O requests completed. something interrupted ur little moment, rude.[EWOULDBLOCK][EINPROGRESS]β The specified time limit expired before any asynchronous I/O requests completed. clock ran out, nothing landed, the audacity β°
π SEE ALSO π
aio_cancel(2), aio_error(2), aio_read(2), aio_return(2), aio_suspend(2), aio_write(2), fsync(2), read(2), write(2), aio(4)
the whole aio friend group, go read them all, iykyk π
β STANDARDS β
The aio_waitcomplete() system call is a FreeBSD-specific extension. not portable bestie, it's a FreeBSD exclusive ποΈ
π HISTORY π
The aio_waitcomplete() system call first appeared in FreeBSD 4.0. vintage. a classic. we stan an elder β¨
π AUTHORS π
The aio_waitcomplete() system call and this manual page were written by Christopher M Sedore <cmsedore@maxwell.syr.edu>. thank u for ur service king π«‘π
ok that's the whole page bestie, u ate that. go queue some async I/O and wait on it like the icon u are π β¨
this lil doc came from the Debian pack, dated March 21, 2016 β yeah it's older than some of us but it still hits π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1999 Christopher M Sedore
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms