io_uring_register_eventfd(3)
π io_uring_register_eventfd(3) β the liburing bestie guide π
okay so bestie, this is a page from the liburing manual, and it's about wiring an eventfd up to your ring so you get lil notifications when stuff finishes. it's short, it's sweet, it's lowkey iconic. let's go π¦
πΈ NAME πΈ
io_uring_register_eventfd β register an eventfd with a ring
like... you're handing the ring a little doorbell. that's the whole vibe. π
β¨ SYNOPSIS β¨
#include <liburing.h>
int io_uring_register_eventfd(struct io_uring *ring,
int fd);
int io_uring_register_eventfd_async(struct io_uring *ring,
int fd);
int io_uring_unregister_eventfd(struct io_uring *ring);
three functions, three moods: register, register but async-only, and unregister. pick your fighter π
π DESCRIPTION π
io_uring_register_eventfd(3) registers the eventfd file descriptor fd with the ring that ring points at. that's it, that's the registration. so official. so demure. π«Ά
and then?? the good part: whenever completions get posted to the CQ ring, an eventfd notification is generated using that registered eventfd descriptor. so your eventfd is basically the ring's group chat β it pings you when things are done. π₯
but wait, there's a plot twist: if you use io_uring_register_eventfd_async(3) instead, then only the events that completed out-of-line will trigger a notification. so it's the selective-notifications version. main character energy, only shows up for the dramatic stuff. β¨
and if you're over it β notifications no longer desired, no cap β you can call io_uring_unregister_eventfd(3) to remove the eventfd registration. heads up: you do not pass an eventfd argument, because a ring can only have a single eventfd registered. one ring, one eventfd, monogamy fr fr π
π NOTES π
okay this part is important so pay attention bestie, i'm being so serious rn π
so io_uring generally takes care to avoid spurious events β key word: generally. they can still occur. π
similarly, batched completions of CQEs may only trigger a single eventfd notification, even if multiple CQEs are posted. like, five CQEs walk into the ring and the doorbell rings once. rude but legal.
so your application should make no assumptions about the number of events being available having a direct correlation to the eventfd notifications posted.
which means: an eventfd notification must only be treated as a hint to go check the CQ ring for completions. it's a vibe check, not a receipt. π
β RETURN VALUE β
returns 0 on success, or -errno on error. classic. no notes. π
π SEE ALSO π
and that's the whole page babes π§ this was the liburing-2.2 manual, dated April 16, 2022, and it was io_uring_register_eventfd(3) all along. go ring your doorbell. mwah π
π¦ where this page comes from
- alpine 3.22: liburing-doc 2.9-r0 Β· LGPL-2.1-or-later OR MIT
- 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
- 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
- debian trixie: liburing-dev 2.9-1
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 43: liburing-devel 2.9-2.fc43 Β· (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)
- 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
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- ubuntu questing: liburing-dev 2.11-1
- ubuntu resolute: liburing-dev 2.14-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