io_uring_wait_cqe_nr(3)
π io_uring_wait_cqe_nr β the liburing manual, bestie edition π
okay so you're deep in liburing land and you need your completions to actually, like, arrive. this page is your girl. no cap.
β¨ NAME β¨
io_uring_wait_cqe_nr β wait for one or more io_uring completion events π¦
πΈ SYNOPSIS πΈ
#include <liburing.h>
int io_uring_wait_cqe_nr(struct io_uring *ring,
struct io_uring_cqe **cqe_ptr,
unsigned wait_nr);
π DESCRIPTION π
so io_uring_wait_cqe_nr(3) hands you back wait_nr IO completion events from the queue that belongs to the ring param, and it will wait for them if it has to. but here's the tea: if the number of events you're asking for is already sitting in the ring when you call it, it does not wait at all. zero patience, love that for it. the cqe_ptr param gets filled in on success. π
once you've submitted a request with io_uring_submit(3), your application can go grab the completion with io_uring_wait_cqe(3).
now for the iconic part: ideally you're using this with a ring that was set up with IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_DEFER_TASKRUN, because that combo greatly reduces the number of context switches an application sees while it's waiting on a whole pile of requests. it's giving efficiency. it's giving main character energy. π₯
β RETURN VALUE β
on success, io_uring_wait_cqe_nr(3) returns 0 and the cqe_ptr param is filled in. on failure it returns -errno. π
okay important thing bestie: the return value is about the result of waiting for a CQE. it has no relation to the CQE result itself. don't mix those up, i'm begging. π
π SEE ALSO π
this page is from liburing-2.1, dated November 15, 2021 β the io_uring_wait_cqe_nr(3) era, and honestly? iconic. mwah. πβ¨π
π¦ 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 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