io_uring_free_buf_ring(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 questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.5 Β· ubuntu noble
, 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 questing, ubuntu resolute, ubuntu stonking

πŸŽ€ io_uring_free_buf_ring β€” the liburing manual, but make it cute πŸŽ€

okay bestie, so this is a page from the liburing Manual, and it's literally the ✨cleanup✨ era of your buffer ring's life. no cap.


✨ NAME ✨

io_uring_free_buf_ring β€” register and free a buffer ring for provided buffers πŸ’…


🌸 SYNOPSIS 🌸

#include <liburing.h>

int io_uring_free_buf_ring(struct io_uring *ring,
                           struct io_uring_buf_ring *br,
                           unsigned int nentries,
                           int bgid);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way that io_uring_free_buf_ring(3) works is: it unregisters a shared buffer ring you already registered before. and like, the ring must have previously been handed to you by io_uring_setup_buf_ring(3) β€” if it didn't come from there, bestie, we're not doing this πŸ’€

here's the vibe check on the arguments:

  • ring β€” must point to the ring that this provided buffer ring was registered for. πŸ‘‘
  • br β€” must point to a buffer ring that io_uring_setup_buf_ring(3) previously returned. no imposter rings allowed πŸ™ˆ
  • nentries β€” the number of entries you requested in that buffer ring. πŸ”’
  • bgid β€” the buffer group ID that br was set up with. gotta match, fr fr. 🏷️

and under the covers? this function uses io_uring_unregister_buf_ring(3) to unregister the ring, and it handles the freeing of the ring for you instead of making your application open code it. it's giving ✨main character energy✨ β€” you just call it, it does the whole little cleanup routine, and you don't have to write the messy bits yourself. obsessed. 🫢

Available since 5.19. ⭐ (yes, that's kernel 5.19, so check your kernel before you get attached)

🌈 RETURN VALUE 🌈

  • On success, io_uring_free_buf_ring(3) returns zero β€” slay. ✨
  • On failure, it returns -errno β€” so it's negative, and the value is the errno. read it, don't ignore it. 😭

πŸ’œ SEE ALSO πŸ’œ


and that's the whole page, bestie. this was liburing-2.4, dated Mar 07, 2023 β€” go forth and free your buffer rings responsibly, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from