io_uring_wait_cqe(3)
π io_uring_wait_cqe β bestie's guide to waiting for your completion π
okay so this is a page from the liburing manual, and we're talking about io_uring_wait_cqe(3), which is lowkey one of the most important lil functions in the whole async I/O world. sit down, grab a strawberry π, let's go.
β¨ NAME β¨
io_uring_wait_cqe β the way you wait for exactly one io_uring completion event, no more no less, periodt π
π SYNOPSIS π
#include <liburing.h>
int io_uring_wait_cqe(struct io_uring *ring,
struct io_uring_cqe **cqe_ptr);
look at her. two params. iconic. π
π¦ DESCRIPTION π¦
so the way io_uring_wait_cqe(3) works is, it waits for an IO completion from the queue that belongs to the ring param, and it will genuinely wait for it if it has to. like, it's not gonna ghost you β if the completion isn't ready yet, it just sits there patiently. π«Ά
but here's the cute part: if an event is already available in the ring when you call it, then no waiting will occur at all. it just grabs it and goes. slay. no unnecessary drama. β¨
the cqe_ptr param gets filled in on success β that's where your completion event lands, bestie. π
so the whole flow is like: after the caller has submitted a request with io_uring_submit(3), the application can retrieve the completion with io_uring_wait_cqe(3). submit β wait β receive. the holy trinity. the main character arc. π₯
π RETURN VALUE π
- On success,
io_uring_wait_cqe(3)returns0and thecqe_ptrparam is filled in. π - On failure, it returns
-errno. π
β οΈ okay important, don't skip this: the return value indicates the result of waiting for a CQE, and it has no relation to the CQE result itself. like, zero. none. they are two completely different things and confusing them is a vibe check you will fail. the wait succeeded β the operation succeeded. keep them separate fr fr π
π SEE ALSO π
and that's the page!! this one's from liburing-2.1, dated November 15, 2021 β so like, vintage but still eating. π go forth and wait for your completions responsibly, bestie. π§πΈ
π¦ where this page comes from
- alpine 3.22: liburing-doc 2.9-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.23: liburing-doc 2.12-r0 Β· LGPL-2.1-or-later OR MIT
- 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
- centos-stream 10: liburing-devel 2.12-1.el10 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- debian trixie: liburing-dev 2.9-1
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- nixpkgs unstable: liburing 2.14
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- ubuntu noble: liburing-dev 2.5-1build1
- ubuntu questing: liburing-dev 2.11-1
- 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) 2021 Stefan Roesch <shr@fb.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms