io_uring_prep_madvise(3)
β¨ io_uring_prep_madvise β¨
okay bestie, so this is a page from the liburing Manual and it's literally about preparing an madvise request for io_uring. yeah. we're doing memory-advice async style π
π NAME π
io_uring_prep_madvise β prepare an madvise request
π¦ SYNOPSIS π¦
#include <sys/mman.h>
#include <liburing.h>
void io_uring_prep_madvise(struct io_uring_sqe *sqe,
void *addr,
__u32 len,
int advice);
void io_uring_prep_madvise64(struct io_uring_sqe *sqe,
void *addr,
off_t len,
int advice);
π DESCRIPTION π
so the io_uring_prep_madvise(3) function gets an madvise request all dressed up and ready to go. it sets up the submission queue entry sqe to kick off an madvise operation at the virtual address addr, running for len bytes, and it's giving it the advice that lives in advice. that's the whole vibe β¨
then there's io_uring_prep_madvise64(3), which is the same thing but it takes a 64-bit length instead of a lil 32-bit one. slay, more bits π
β οΈ heads up bestie: older kernels might not support the 64-bit length variant. if you try to use it on a kernel that doesn't do 64-bit lengths, the request gets errored out with -EINVAL in the results field of the CQE. no cap, that's the error you'll see π
this function prepares an async madvise(2) request. go check that man page for the details, iykyk π«Ά
πΈ RETURN VALUE πΈ
None. that's it. nothing. it's giving void energy, periodt β¨
π ERRORS π
the CQE res field is where the result of the operation shows up. peep the related man page for all the possible values π
and here's the important bit, bestie: where synchronous system calls will return -1 on failure and set errno to the actual error value β io_uring never uses errno. instead it returns the negated errno directly in the CQE res field. so like, no errno detective work needed, the answer is right there π₯
π SEE ALSO π
and that's the page, angel π this whole thing came from liburing-2.2, dated March 13, 2022 β so if you're reading this from the future, hi, the lore is preserved πβ¨ go forth and madvise responsibly, 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
- 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
- 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