io_uring_prep_remove_buffers(3)

πŸ’– io_uring_prep_remove_buffers β€” the liburing manual, but make it cute πŸ’–

okay bestie so this is a page from the liburing Manual, and it's about io_uring_prep_remove_buffers(3). yes the name is a whole mouthful, we're gonna get through it together 🫢


✨ NAME ✨

io_uring_prep_remove_buffers β€” prepare a remove buffers request

like, it preps a request. that removes buffers. the name is not being mysterious, it's being honest πŸ’…


🌸 SYNOPSIS 🌸

#include <liburing.h>

void io_uring_prep_remove_buffers(struct io_uring_sqe *sqe,
                                  int nr,
                                  int bgid);

there she is. three arguments, zero drama, returns nothing πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so the io_uring_prep_remove_buffers(3) function prepares a request for removing previously supplied buffers. you're literally telling the kernel "hey, take some of those buffers back" 🧚

the submission queue entry sqe gets set up to remove nr number of buffers from the buffer group ID indicated by bgid.

that's it. that's the whole job. sqe = which entry, nr = how many, bgid = which buffer group. three little numbers and a whole vibe ✨

heads up: the buffers have to be previously supplied ones β€” you can't remove what was never there, iykyk πŸ™ˆ

πŸ’œ RETURN VALUE πŸ’œ

None

literally nothing. this function returns void. the ✨real✨ answer shows up later in the CQE, so keep reading, bestie πŸ‘‘


πŸ’€ ERRORS πŸ’€

okay so these are the errors that are reported in the CQE res field. not a return value, the CQE res field. important distinction, don't come for me.

on success, res will contain the number of successfully removed buffers. so like, you get a little receipt 🧾

on error, the following errors can occur:

  • -ENOMEM β€” the kernel was unable to allocate memory for the request. it's giving broke energy, the kernel simply could not πŸ₯²
  • -EINVAL β€” one of the fields set in the SQE was invalid. you put something in there that it did not want πŸ’€ check your fields, bestie
  • -ENOENT β€” no buffers exist at the specified bgid buffer group ID. there's nothing at that address. empty. ghost town. the group ID said "never heard of her" πŸ‘»

🌈 SEE ALSO 🌈

go read these next, fr fr, they're the whole friend group:


πŸŽ€ ok that's the page πŸŽ€

this whole thing came out of liburing-2.2, dated March 13, 2022 β€” so yes, she's a little vintage but she still ate πŸ’…βœ¨ thanks for reading, go remove some buffers responsibly, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from