io_queue_init(3)
π io_queue_init(3) π
okay bestie, welcome to the Linux AIO corner of the manual β yes it's a section 3 page, yes it's iconic, let's get into it π¦
β¨ NAME β¨
io_queue_init β spins up your asynchronous io state machine, no cap π
β¨ SYNOPSIS β¨
#include <errno.h>
#include <libaio.h>
int io_queue_init(int maxevents, io_context_t *ctx);
β¨ DESCRIPTION β¨
so io_queue_init() tries to create an aio context β like, a whole setup that can receive at least maxevents events. that's the vibe π
now listen, ctx has to point to an aio context that already exists, and it must be initialized to 0 before you call this. do not skip that part, i'm literally begging π
if everything goes right, *cxtp gets filled in with the resulting handle. slay β¨
β¨ RETURN VALUES β¨
on success, io_queue_init() returns 0. queen behavior π
otherwise it returns -error, where error is one of the Exxx values listed down in the ERRORS section. so like, negative number, look it up, that's the assignment π
β¨ ERRORS β¨
EFAULTβ theiocbsreferenced data that lives outside the program's accessible address space. nope, not allowed, that's not your house π«EINVALβ eithermaxeventsis<= 0, orctxis an invalid memory location. zero events? negative events? a fake address? bestie no πENOSYSβ not implemented. it's giving "we didn't build that" πEAGAINβmaxeventsis greater thanmax_aio_reqs, wheremax_aio_reqsis a tunable value. you asked for too much, tune it down πΈ
β¨ SEE ALSO β¨
io(3), io_cancel(3), io_fsync(3), io_getevents(3), io_prep_fsync(3), io_prep_pread(3), io_prep_pwrite(3), io_queue_release(3), io_queue_run(3), io_queue_wait(3), io_set_callback(3), io_submit(3), errno(3).
go read those too, i know you will, you're so good at this π«Ά
mwah π this one's from the Linux AIO crew, dated 2019-07-23 β yeah she's a classic, and she's still serving. periodt. π
π¦ where this page comes from
- alpine 3.22: libaio-doc 0.3.113-r2 Β· LGPL-2.1-or-later
- alpine 3.23: libaio-doc 0.3.113-r2 Β· LGPL-2.1-or-later
- alpine 3.24: libaio-doc 0.3.113-r2 Β· LGPL-2.1-or-later
- arch rolling: libaio 0.3.113-5 Β· LGPL-2.0-or-later
- debian bookworm: libaio-dev 0.3.113-4 Β· LGPL-2.1-or-later
- debian trixie: libaio-dev 0.3.113-8+b1 Β· LGPL-2.1-or-later
- ubuntu jammy: libaio-dev 0.3.112-13build1 Β· LGPL-2.1-or-later
- ubuntu noble: libaio-dev 0.3.113-6build1 Β· LGPL-2.1-or-later
- ubuntu noble: libaio-dev 0.3.113-6build1.1 Β· LGPL-2.1-or-later
- ubuntu questing: libaio-dev 0.3.113-8
- ubuntu resolute: libaio-dev 0.3.113-8build1 Β· LGPL-2.1-or-later
- ubuntu stonking: libaio-dev 0.3.113-9 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms