io_uring_prep_epoll_wait(3)
π io_uring_prep_epoll_wait β bestie edition π
okay so this is a page from the liburing manual, io_uring_prep_epoll_wait(3), and honestly? it's giving "letting your legacy event loop finally move on." sit down, grab a boba, we're doing this π§β¨
β¨ NAME β¨
io_uring_prep_epoll_wait β prepare an epoll wait request
πΈ SYNOPSIS πΈ
#include <sys/epoll.h>
#include <liburing.h>
void io_uring_prep_epoll_wait(struct io_uring_sqe *sqe,
int fd,
struct epoll_event *events,
int maxevents,
unsigned flags );"
(yeah the original page literally ends that synopsis with a stray " and I am not touching it, that's canon now π
)
π¦ DESCRIPTION π¦
So io_uring_prep_epoll_wait(3) prepares an epoll_wait request. Like, it sets up the submission queue entry sqe to wait on a maximum of maxevents events on the epoll file descriptor that fd points at, and it drops the received events into the memory that events points to. cute, clean, done π
What you're actually doing here is preparing an async epoll_wait(2) request. go read that man page for the deets, fr fr.
and like, why would you even want this? π the use case is mostly for legacy event loops, where some file descriptors might still be living their epoll lives for readiness notifications. normally you'd have to call epoll_wait and also add the io_uring fd into that same epoll set β which is, ngl, suboptimal, because epoll doesn't give you the same fine grained batch control and wakeup reductions that io_uring does. π
but by using io_uring to read epoll events? the event loop can switch over to io_uring entirely, and then it reaps the benefits of batch waiting and context switch reductions. glow up complete, main character energy, periodt π
π RETURN VALUE π
None. that's it, that's the whole vibe. nothing comes back from this function directly π«Ά
π ERRORS π
the result of the operation lives in the CQE res field. check the related man page for what possible values look like.
β οΈ and listen, this part is important: synchronous system calls return-1on failure and seterrnoto the actual error value, but io_uring never useserrno. instead it returns the negated errno directly in the CQEresfield. so stop checkingerrno, bestie, it's not gonna be there π
π SEE ALSO π
okay that's the whole page!! π this was liburing-2.10, dated March 6, 2025 β go forth and make your event loop iconic, you got this βπ¦π
π¦ where this page comes from
- alpine 3.23: liburing-doc 2.12-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.24: liburing-doc 2.14-r0 Β· LGPL-2.1-or-later OR MIT
- arch rolling: liburing 2.15-1 Β· GPL-2.0-only WITH Linux-syscall-note OR MIT AND LGPL-2.0-or-later AND MIT
- centos-stream 10: liburing-devel 2.12-1.el10 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- nixpkgs unstable: liburing 2.14
- ubuntu questing: liburing-dev 2.11-1
- ubuntu resolute: liburing-dev 2.14-1
- ubuntu stonking: liburing-dev 2.15-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms