io_uring_reg..._alloc_range(3)

πŸ“¦
version 2.14 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, ubuntu questing, ubuntu resolute

πŸ’– io_uring_reg..._alloc_range(3) πŸ’–

okay bestie, welcome to the liburing Manual ✨ this is the page for io_uring_register_file_alloc_range, and it's lowkey iconic. sit down, grab a strawberry πŸ“, let's get into it.


✨ NAME ✨

io_uring_register_file_alloc_range β€” set the range for fixed file allocations, periodt πŸ’…


🌸 SYNOPSIS 🌸

#include <liburing.h>

int io_uring_register_file_alloc_range(struct io_uring *ring,
                                       unsigned off,
                                       unsigned len);

look at her. three little arguments. she's so clean πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜• β€” io_uring_register_file_alloc_range(3) sets the allowable range for fixed file index allocations inside the kernel. that's the whole vibe.

now, when you've got requests that can instantiate a brand new fixed file, and you use them together with IORING_FILE_INDEX_ALLOC, your application is basically telling the kernel: "bestie, you pick the descriptor, I'm not giving you a specific value for one." and by default, the kernel will just pick any available fixed file descriptor within the range that's available. no thoughts, head empty, just vibes 😌

but that's where this function comes in!! if you call it with off set to the starting offset and len set to the number of descriptors, your application can limit the allocated descriptors to that particular range. so cute, so controlled ✨

and honestly? the practical effect is slay: it effectively lets the application set aside a range just for dynamic allocations, while the remainder gets used for specific values. like partitioning your closet but for file descriptors πŸ‘‘

important bestie!! 🚨 the application must have registered a fixed file table upfront β€” for example through io_uring_register_files(3) or io_uring_register_files_sparse(3). no table, no range, no dice. don't skip this step, fr fr 😭

Available since 6.0. so if you're on something ancient, that's a you problem πŸ™ˆ


πŸ’œ RETURN VALUE πŸ’œ


🌈 SEE ALSO 🌈

go read them, iykyk πŸ‘‘


and that's the page!! this whole thing is liburing-2.3, dated Oct 21, 2022 β€” so it's giving vintage but make it cute πŸŽ€ mwah, bye bestie πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from