io_uring_close_ring_fd(3)
π io_uring_close_ring_fd β the liburing glow-up where your fd justβ¦ dips π
okay bestie, so this is a page from the liburing manual, and it's about the absolute main-character move of closing a ring file descriptor and living your life through a registered index instead. no cap.
β¨ NAME β¨
io_uring_close_ring_fd β close a ring file descriptor and use it only via registered index π¦
πΈ SYNOPSIS πΈ
#include <liburing.h>
int io_uring_close_ring_fd(struct io_uring *ring);
π DESCRIPTION π
so like, io_uring_close_ring_fd(3) closes the ring file descriptor, and that fd must have been previously registered, periodt. the file itself stays open btw β it doesn't go anywhere β but now you can only reach it via the registered index, not via any file descriptor at all. she's exclusive now π
.
and here's the slay part: subsequent liburing calls keep working just fine, because they use the registered ring fd instead. nothing breaks, everything continues, it's giving seamless π₯.
your kernel has to support IORING_FEAT_REG_REG_RING for any of this to hit, so check that first bestie, fr fr.
now, why would anyone want this? libraries that must avoid disrupting their users' uses of file descriptors, and that also need to keep working even when faced with close_range(2) and similar fd-nuking situations, can use io_uring_close_ring_fd(3) to work with liburing while having zero open file descriptors. imagine the peace. no fd left behind. iconic β¨.
π«Ά NOTES π«Ά
every single thread that wants to make use of io_uring has to register the fd. yes, every one. no shortcuts π.
so a library that might get called from arbitrary threads may need to detect when it gets called on a thread it's never seen before, and then create and register a ring for that thread. basically: new thread, who dis? here's your ring π.
β RETURN VALUE β
1β success, you ate π-errnoβ error, and it tells you which one via errno π
π SEE ALSO π
and that's the whole vibe, bestie π β this page came from liburing-2.4, dated September 25, 2022. go forth and close that fd like the icon you are πβ¨π
π¦ 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
- 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
- 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 noble: liburing-dev 2.5-1build1
- 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>
- Copyright (C) 2022 Josh Triplett <josh@joshtriplett.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms