io_uring_enable_rings(3)

✨ io_uring_enable_rings β€” the glow-up button for your ring πŸ’…

okay bestie, we're talking about io_uring_enable_rings(3), from the liburing Manual. she's a little function with one job and she does it flawlessly, no cap 🫢


🌸 NAME 🌸

io_uring_enable_rings β€” enable a disabled ring ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <liburing.h>

int io_uring_enable_rings(struct io_uring *ring);

like. that's it. that's the whole vibe. one include, one call. iconic behavior honestly πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

so here's the tea πŸ“: you can create a ring in a whole paused state β€” fully built, just not allowed to do anything yet β€” by passing the IORING_SETUP_R_DISABLED flag to io_uring_queue_init(3). it's giving "born ready but on do-not-disturb mode" 😭

then when you're finally ready to let her cook, you hit her with io_uring_enable_rings(3) and boom πŸ’₯ β€” the ring is enabled, the DND is off, we're live.

and fr fr, this is the important part: while that ring is still disabled, it is not possible to submit work to it. like, zero. none. not until this function has been successfully called. no shortcuts, no sneaking around it, periodt πŸ’€

so the order is literally: create with the flag ➑️ call this function ➑️ then you may submit. that's the whole storyline, main character energy from start to finish 🌈


πŸ‘‘ RETURN VALUE πŸ‘‘

  • 0 β€” slay! success, we ate, the ring is enabled πŸ’…
  • negative error code β€” something went sideways, check below

and a lil note that matters a lot: it does not write to errno. so don't go staring at errno wondering why it's empty, bestie, the answer was in the return value the whole time πŸ™ˆ


πŸ’€ ERRORS πŸ’€

  • EBADFD β€” the ring was not disabled. yeah, you tried to enable something that was already enabled. it's giving "turning on a light that's already on" 😭 nothing was wrong with the ring, it just wasn't in the state you thought it was in.

🌟 SEE ALSO 🌟


🧚 a lil sign-off 🧚

this page lives in liburing-2.7, dated July 26, 2024, and it's literally titled io_uring_enable_rings(3) if you ever need to cite her. go enable some rings, bestie, you got this πŸ’œβœ¨

πŸ“¦ where this page comes from