io_uring_register_buffers(3)
β¨ io_uring_register_buffers β¨
okay bestie, welcome to the liburing manual β this one is literally all about registering buffers so your fixed buffer ops can pop off π
π NAME π
io_uring_register_buffers β register buffers for fixed buffer operations π¦
πΈ SYNOPSIS πΈ
#include <liburing.h>
int io_uring_register_buffers(struct io_uring *ring,
const struct iovec *iovecs,
unsigned nr_iovecs);
int io_uring_register_buffers_tags(struct io_uring *ring,
const struct iovec *iovecs,
const __u64 *tags,
unsigned nr);
int io_uring_register_buffers_sparse(struct io_uring *ring,
unsigned nr_iovecs);
int io_uring_register_buffers_update_tag(struct io_uring *ring,
unsigned off,
const struct iovec *iovecs,
const __u64 *tags,
unsigned nr);
π DESCRIPTION π
so. io_uring_register_buffers(3) registers nr_iovecs number of buffers β and those buffers are defined by the array iovecs, and they belong to the ring. that's the whole vibe π«
io_uring_register_buffers_tags(3) does exactly the same thing as io_uring_register_buffers(3), no cap β but it additionally takes a tags parameter. if you wanna know how the resource tagging works, go look at IORING_REGISTER_BUFFERS2, it's all there π«Ά
io_uring_register_buffers_sparse(3) registers nr_iovecs empty buffers belonging to the ring. bestie, listen β these buffers must be updated before use, like using io_uring_register_buffers_update_tag(3) or whatever equivalent. don't skip that step, i'm serious π
once the caller has registered the buffers, they can be used with one of the fixed buffers functions. iconic behavior honestly π
registered buffers are an optimization β and the tea is that it's super useful alongside O_DIRECT reads and writes. the way it works is: it maps the specified range into the kernel once, when the buffer is registered, instead of doing a whole map-and-unmap for every single IO every single time IO is performed to that region. exhausting, right? additionally, it also avoids manipulating the page reference counts for each IO. efficiency queen β¨
io_uring_register_buffers_update_tag(3) updates registered buffers with new ones β either turning a sparse entry into a real one, or replacing an existing entry, dealer's choice π
the off is the offset on which to start the update, and it updates nr number of buffers defined by the array iovecs belonging to the ring. the tags points to an array of tags. again, for the resource tagging description, see IORING_REGISTER_BUFFERS2 π
π¦ RETURN VALUE π¦
on success, io_uring_register_buffers(3), io_uring_register_buffers_tags(3) and io_uring_register_buffers_sparse(3) return 0. slay β
io_uring_register_buffers_update_tag(3) returns the number of buffers updated β so it's not just a boring old zero, it's giving receipts π
on failure they return -errno. yeah. that kind of failure π
π₯ SEE ALSO π₯
io_uring_register(2)io_uring_get_sqe(3)io_uring_unregister_buffers(3)io_uring_clone_buffers(3)io_uring_register_buf_ring(3)io_uring_prep_read_fixed(3)io_uring_prep_write_fixed(3)
and that's the page, bestie β this whole thing came to you from liburing-2.1, dated November 15, 2021. mwah, go register those buffers ππ§ββοΈ
π¦ 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) 2021 Stefan Roesch <shr@fb.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms