io_uring_queue_mmap(3)

πŸ’– io_uring_queue_mmap β€” bestie, we're mapping the ring

okay so real talk, this is a page from the liburing manual (section 3, the library functions girlies) and it's about one very specific little function. let's get into it πŸ’…


✨ NAME ✨

io_uring_queue_mmap β€” mmap your io_uring ring after setup, no cap πŸ¦‹


🌸 SYNOPSIS 🌸

#include <liburing.h>

int io_uring_queue_mmap(int fd, struct io_uring_params *p,
                        struct io_uring *ring);

πŸ’œ DESCRIPTION πŸ’œ

so the way that io_uring_queue_mmap(3) works is: it takes your io_uring ring file descriptor fd and maps it into memory, using the parameters you pass in p. and then the resulting ring gets stored in ring. that's it, that's the whole job ✨

and like… this one is a helper function, okay? it's for the applications that need to customize their ring setup process themselves. it's giving DIY main character energy πŸ”₯

bestie, listen β€” most applications should NOT be calling this directly. most of y'all should be using io_uring_queue_init(3) or io_uring_queue_init_params(3) instead, because those two call io_uring_setup(2) and this function for you automatically. so unless you have a very specific reason, let them cook πŸ‘‘

and for the record, so there's no confusion:

  • the fd argument should be a file descriptor that was returned by io_uring_setup(2)
  • the p argument should contain the parameters returned by that setup call

like, they have to match up. you can't just hand it a random fd and a random struct and expect the ring to slay πŸ’€


πŸŽ€ RETURN VALUE πŸŽ€

  • returns 0 on success 🫢
  • returns a negative errno value on error 😭

that's the whole vibe check. zero means we ate. negative means something went wrong and the number tells you what.


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page, babes πŸ’– this one's from liburing-2.4, dated January 18, 2025 β€” go forth and map responsibly, and pls just use io_uring_queue_init(3) unless you genuinely know why you're here 🌈⭐🧚

πŸ“¦ where this page comes from