io_getevents(2)
π io_getevents(2) β System Calls Manual π
okay bestie, so this is a Linux system call manual page for io_getevents, and it's all about picking up your async I/O results when they're finally done cooking. no cap, it's giving "completion queue reading" energy and honestly? iconic. π
β¨ NAME β¨
io_getevents β read asynchronous I/O events from the completion queue πΈ
π LIBRARY π
Standard C library (libc, -lc) π«Ά
π¦ SYNOPSIS π¦
#include <linux/aio_abi.h> /* Definition of *io_* types */
#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
int syscall(SYS_io_getevents, aio_context_t ctx_id,
long min_nr, long nr, struct io_event *events,
struct timespec *timeout);
π DESCRIPTION π
heads up queen: you probably want to use theio_getevents(3)wrapper function provided bylibaioinstead β scroll down to VERSIONS for the tea. π
The io_getevents() system call attempts to read at least min_nr events and up to nr events from the completion queue of the AIO context specified by ctx_id. literally it's just collecting your finished async homework π¬
The timeout argument specifies the amount of time to wait for events, and is specified as a relative timeout in a timespec(3) structure. β³
The specified time will be rounded up to the system clock granularity and is guaranteed not to expire early. yes bestie, it's punctual like that β¨
Specifying timeout as NULL means block indefinitely until at least min_nr events have been obtained. we're waiting FOREVER (or at least until the events show up) π
π₯ RETURN VALUE π₯
On success, io_getevents() returns the number of events read. this might be 0, or a value less than min_nr, if the timeout expired. it may also be a nonzero value less than min_nr if the call was interrupted by a signal handler. so likeβ¦ you might get less than you asked for, and that's valid π
On error, -1 is returned, and errno is set to indicate the error. π
π ERRORS π
EFAULTβ Eithereventsortimeoutis an invalid pointer. π«EINTRβ Interrupted by a signal handler; seesignal(7).EINVALβctx_idis invalid. π«EINVALβmin_nris out of range ornris out of range.ENOSYSβio_getevents()is not implemented on this architecture. π
π VERSIONS π
libaio provides a wrapper function with the same name, but with a different prototype and return value. You probably want to use that wrapper. like fr fr, that's the one you want π§
β STANDARDS β
Linux. π§ that's it, that's the standard.
πΈ HISTORY πΈ
Linux 2.5. a true elder of the async world, and she still slays π
π«Ά SEE ALSO π«Ά
io_cancel(2), io_destroy(2), io_setup(2), io_submit(2), io_getevents(3), timespec(3), aio(7), time(7)
okay that's the whole page bestie, mwah π β this was Linux man-pages 6.20, dated 2026-04-11, and it ate, no crumbs left. go read the io_getevents(3) wrapper instead, iykyk πβ¨π
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-1.0-or-later
- Copyright 2003, Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms