io_uring_buf_ring_available(3)
β¨ io_uring_buf_ring_available β the "bestie how many buffers do I even have left" helper β¨
okay so this is io_uring_buf_ring_available(3), and it lives in the liburing manual, section 3. it's the little function you call when you're like "wait. how many of my provided ring buffer entries has the kernel NOT eaten yet" π
and honestly? iconic of it to exist.
πΈ NAME πΈ
io_uring_buf_ring_available</p> β returns the number of unconsumed provided ring buffer entries π
β¨ SYNOPSIS β¨
#include <liburing.h>
int io_uring_buf_ring_available(struct io_uring *ring,
struct io_uring_buf_ring *br,
unsigned short bgid);
like. three args. so chill. π¦
π DESCRIPTION π
so the io_uring_buf_ring_available(3) helper returns the number of unconsumed entries β unconsumed by the kernel, bestie, that's the key part β in the br provided buffer group. that group belongs to the io_uring ring and it's identified by the buffer group ID bgid. π«Ά
and here's the β¨plot twistβ¨: the head of the provided buffer ring is only visible to the kernel. so there is literally no other way for you to know how many unconsumed entries are chillin' in that provided buffer ring. none. this function goes and queries the kernel to get that number back for you. it's giving personal assistant energy, fr fr. π
available since kernel 6.8 π§ β so if you're on something older, this is not the vibe, sorry bestie π
π NOTES π
the number it hands back reflects the amount of unconsumed entries at the exact time it was queried. periodt.
and ngl, if there's inflight IO that might consume provided buffers from this buffer group, then the returned value is inherently racy. like, no cap, it's a snapshot, not a promise. π
π RETURN VALUE π
- on success β returns the number of unconsumed entries, which may be 0 (yes, zero is a valid slay, it just means nothing's left) β¨
- on error β it may return:
-ENOENTβ if the specified buffer group doesn't exist π-EINVALβ if the buffer group isn't of the correct type, or if the kernel doesn't support this feature π
π SEE ALSO π
the whole provided-buffer-ring friend group, iykyk π
and that's the whole page, bestie!! π this one's from the liburing Manual, version liburing-2.6, dated Jan 11, 2024 β mwah, go query that kernel, ily π«ΆπΈπ
π¦ 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 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