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 the io_getevents(3) wrapper function provided by libaio instead β€” 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 β€” Either events or timeout is an invalid pointer. 🫠
  • EINTR β€” Interrupted by a signal handler; see signal(7).
  • EINVAL β€” ctx_id is invalid. 🚫
  • EINVAL β€” min_nr is out of range or nr is 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms