io_uring_prep_read_fixed(3)
π io_uring_prep_read_fixed β the liburing manual, but make it cute β¨
okay so bestie, you know io_uring_prep_read? This is its fixed-buffer sister, and she is iconic. It's a liburing function, and no cap, it's giving "I read into memory you already registered" energy. Let's get into it π
β¨ NAME β¨
io_uring_prep_read_fixed β prepare an I/O read request with a registered buffer π¦
πΈ SYNOPSIS πΈ
#include <liburing.h>
void io_uring_prep_read_fixed(struct io_uring_sqe *sqe,
int fd,
void *buf,
unsigned nbytes,
__u64 offset,
int buf_index);
π DESCRIPTION π
So io_uring_prep_read_fixed(3) sets up an I/O read request that reads into a buffer you previously registered. Like, you already did the registration thing, now you're cashing in on it. π
The submission queue entry sqe gets set up to use the file descriptor fd to start reading nbytes into the buffer buf at the specified offset, and the buffer it matches up with is the registered index buf_index. Slay.
This works just like io_uring_prep_read(3), except β and this is the whole plot twist β it requires you to use buffers that have been registered with io_uring_register_buffers(3). No registration, no service. π
The buf and nbytes arguments must fall within a region specified by buf_index in the previously registered buffer. That's a requirement, not a suggestion, fr fr. Good news though: the buffer does not need to be aligned with the start of the registered buffer. So you've got wiggle room, bestie. π
After the read has been prepared, you can submit it with one of the submit functions. Then you wait, and the kernel does its little thing. β¨
π«Ά RETURN VALUE π«Ά
None. That's it. That's the whole return value. She prepares and dips. π
π ERRORS π
The CQE res field will contain the result of the operation β that's where the actual tea lives. See the related man page for details on possible values.
β οΈ Big important thing, and I need you to listen: where synchronous system calls will return-1on failure and seterrnoto the actual error value, io_uring never useserrno. Instead, it returns the negatederrnodirectly in theCQEresfield. So if you're out here checkingerrnoafter an io_uring op, you're looking in the wrong place and it's not gonna work out. π
π SEE ALSO π
and that's the page, bestie! this one's from liburing-2.1, dated February 13, 2022 β the liburing manual, written by the liburing girlies, and honestly? we're obsessed. go register those buffers and read something. 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
- 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