io_uring_cqe_nr(3)
π io_uring_cqe_nr β bestie edition π
okay so this one is from the liburing manual, and honestly? it's short, it's sweet, and it's lowkey essential if you're out here living that mixed-CQE life. no cap. π¦
β¨ NAME β¨
io_uring_cqe_nr β returns the number of CQ ring slots that a CQE has eaten. that's it, that's the whole job. it's giving "small but mighty" π
πΈ SYNOPSIS πΈ
#include <liburing.h>
unsigned io_uring_cqe_nr(const struct io_uring_cqe *cqe);
π DESCRIPTION π
so, io_uring_cqe_nr(3) tells you how many CQ ring slots your cqe has consumed. like, how much room did this little guy take up in the ring? π«Ά
here's the tea:
- for normal 16-byte CQEs, it returns
1. one slot. a single serving. perfectly reasonable. β¨ - for 32-byte CQEs, which happen when
IORING_CQE_F_32is set in the CQE flags, it returns2. two slots. it's an overachiever, we love that for it. π
and why do you care, bestie? because when you're advancing the CQ ring with io_uring_cq_advance(3) on rings that use IORING_SETUP_CQE_MIXED β where both 16-byte and 32-byte CQEs can show up in the same ring, chaos incarnate β you can't just assume every CQE takes one slot. that's a trap. this function is your vibe check. it tells you exactly how far to advance so you don't skip past a CQE or trip over your own ring. main character energy fr fr π
not me almost advancing by one when a 32-byte CQE was sitting there the whole time π
π RETURN VALUE π
- returns
1for normal CQEs - returns
2for 32-byte CQEs
that's it. two possible answers. no in-between, no drama, no edge cases beyond that. periodt. π
π SEE ALSO π
kisses, bestie π«Ά this page is from liburing-2.12, dated January 18, 2025, and that's the whole manual. go advance your ring correctly, i'm so proud of you ππ
π¦ where this page comes from
- alpine 3.24: liburing-doc 2.14-r0 Β· LGPL-2.1-or-later OR MIT
- arch rolling: liburing 2.15-1 Β· GPL-2.0-only WITH Linux-syscall-note OR MIT AND LGPL-2.0-or-later AND MIT
- nixpkgs unstable: liburing 2.14
- ubuntu resolute: liburing-dev 2.14-1
- ubuntu stonking: liburing-dev 2.15-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2025 Jens Axboe <axboe@kernel.dk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms