io_uring_cqe_get_data(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_cqe_get_data β€” get user data for completion event ✨

okay bestie, so this one is from the liburing manual, and it's genuinely such a vibe once you get it. it's giving "the completion came back, now who sent it??" πŸ¦‹


🌸 SYNOPSIS 🌸

#include <liburing.h>

void *io_uring_cqe_get_data(struct io_uring_cqe *cqe);

__u64 io_uring_cqe_get_data64(struct io_uring_cqe *cqe);

literally just two little functions, both taking a cqe, both handing you back your user_data. slay. πŸ’…


πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie πŸ“

The io_uring_cqe_get_data(3) function returns the user_data with the completion queue entry cqe as a data pointer.

The io_uring_cqe_get_data64(3) function returns the user_data with the completion queue entry cqe as a 64-bit data value.

the way that this works: after the caller has received a completion queue entry (CQE) with io_uring_wait_cqe(3), the application can call io_uring_cqe_get_data(3) or io_uring_cqe_get_data64(3) function to retrieve the user_data value. 🫢

and like… this requires that user_data has been set earlier with the function io_uring_sqe_set_data(3) or io_uring_sqe_set_data64(3). so it's a matching set, okay? you put the little name tag on the way out, you read the name tag on the way back. iconic behavior. πŸŽ€


⭐ RETURN VALUE ⭐

If the user_data value has been set before submitting the request, it will be returned.

Otherwise, the return value is undefined. 😭 like not "oh it returns NULL" β€” undefined. so set your data, bestie. don't be out here rawdogging it and then acting surprised. πŸ’€

fr fr: no user_data set means you get whatever, and "whatever" is not a guarantee. main character energy requires preparation. πŸ‘‘

🌈 SEE ALSO 🌈


k bye ily, go tag your SQEs πŸ’œ

this page was served to you by liburing-2.1, dated November 15, 2021 β€” oldie but a goodie, no cap. 🧚✨

πŸ“¦ where this page comes from