io_uring_wait_cqe_timeout(3)
π io_uring_wait_cqe_timeout β bestie edition π
okay so this is a page from the liburing Manual, and it's literally the blueprint for io_uring_wait_cqe_timeout, a little function that sits there and waits for your ring to hand you a completion. no cap, it's giving patient friend energy. πΈ
β¨ NAME β¨
io_uring_wait_cqe_timeout β bestie, it waits for one io_uring completion event, but with a timeout so you're not stuck waiting forever. π
π¦ SYNOPSIS π¦
#include <liburing.h>
int io_uring_wait_cqe_timeout(struct io_uring *ring,
struct io_uring_cqe **cqe_ptr,
struct __kernel_timespec *ts);
π DESCRIPTION π
so the io_uring_wait_cqe_timeout(3) function is out here waiting for one IO completion to become available from the queue that belongs to the ring param. it'll wait for it if it has to β or it'll wait until the timeout ts expires, whichever comes first. and listen: if an event is already available in the ring when you call it, there is no waiting happening at all. zero. it just hands it over. π«Ά
the cqe_ptr param gets filled in on success. that's the whole point, that's your prize. π
now here's the tea about ts and kernels. if ts is specified and you're on an older kernel that does not have IORING_FEAT_EXT_ARG, then the application does not need to call io_uring_submit(3) before calling io_uring_wait_cqes(3). but for newer kernels where that feature flag is set, there is no implied submit when you're waiting for a request. so don't go assuming it submitted for you, bestie. π
and if ts is NULL? then this behaves exactly like io_uring_wait_cqe(3) β meaning it will wait forever for an event. forever forever. main character commitment. π
π RETURN VALUE π
on success, io_uring_wait_cqe_timeout(3) returns 0 and the cqe_ptr param is filled in. on failure it returns -errno. π
and this part matters: the return value tells you the result of waiting for a CQE β it has absolutely no relation to the CQE result itself. two totally different things, don't mix them up. and if a timeout occurs, it will return -ETIME. periodt.
π SEE ALSO π
that's the whole page, no notes. π this was liburing-2.1, dated November 15, 2021 β go forth and wait on your completions responsibly, ily. ππ¦β¨
π¦ where this page comes from
- 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
- 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
- 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