io_uring_prep_fallocate(3)

πŸ“¦
version 2.15 Β· 2 versions
  • 2.15 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.3 Β· debian bookworm
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ io_uring_prep_fallocate ✨

okay bestie, welcome to the liburing manual πŸ’– this is the page for io_uring_prep_fallocate, and yes it's exactly as iconic as it sounds.


πŸŽ€ NAME πŸŽ€

io_uring_prep_fallocate</purl> β€” get a fallocate request ready to go πŸ’…


🌸 SYNOPSIS 🌸

#include <fcntl.h>
#include <liburing.h>

void io_uring_prep_fallocate(struct io_uring_sqe *sqe,
                             int fd,
                             int mode,
                             __u64 offset,
                             __u64 len);

like. look at that signature. she's serving. no return value, she just does things. periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

so the function io_uring_prep_fallocate(3) does one job and does it gorgeously: she preps a fallocate request. that's it, that's the whole vibe.

the submission queue entry sqe gets set up to use the file descriptor that fd points to, and it kicks off a fallocate operation. that operation is described by mode, and it happens at offset offset, stretching for len length in bytes. (yes, offset is both the parameter name and the word describing where it starts. she contains multitudes. we stan. 😭)

what you're actually cooking here is an async version of fallocate(2) β€” so like, the real one, just not blocking your whole life waiting on it. go read that man page if you want the details, bestie, because this one's just the setup girlie.


πŸ’œ RETURN VALUE πŸ’œ

None. she returns nothing. she's mysterious like that. πŸ™ˆ


πŸ”₯ ERRORS πŸ”₯

okay so this is the part where you don't go looking for a return value, because there isn't one. instead, the res field of the CQE will hold the result of the operation. head to the related man page for what values might show up there. πŸ‘‘

and here's the big one, the thing that trips people up literally every time, so listen up:

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 no errno hunting, no perror spirals. the answer is right there in res, just negative. iykyk. πŸ’€


🌈 SEE ALSO 🌈


and that's the whole page, bestie!! 🫢 this was liburing-2.2, from March 13, 2022, out of the liburing Manual β€” thank you for coming to my ted talk, go forth and prep your SQEs responsibly πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ‘‘β­

πŸ“¦ where this page comes from