io_uring_prep_timeout_update(3)
π io_uring_prep_timeout_update β bestie edition π
okay so this is a page from the liburing Manual, and we're talking about io_uring_prep_timeout_update(3) β the girlies who edit timeouts instead of just making them. she's the glow-up arc of timeout requests, fr fr. β¨
β¨ NAME β¨
io_uring_prep_timeout_update β get a request ready to update an existing timeout
π SYNOPSIS π
#include <liburing.h>
void io_uring_prep_timeout_update(struct io_uring_sqe *sqe,
const struct __kernel_timespec *ts,
__u64 user_data,
unsigned flags);
void io_uring_prep_timeout_remove(struct io_uring_sqe *sqe,
__u64 user_data,
unsigned flags);
π DESCRIPTION π
so basically these two functions are the modify-and-cancel squad for timeouts you already have going. they take your submission queue entry sqe and set it up to either update or remove a timeout β which one you're messing with is picked out by user_data, and the modifier behaviour comes from flags.
and because it's an update, bestie, it also takes a ts structure, and ts is where the new timeout info lives. new numbers, new deadline, new vibe. π«
for an update request, that flags member can be a bitmask made of these cuties:
IORING_TIMEOUT_ABSβ the value you dropped intsis an absolute value, not a relative one. no counting from now, she's an absolute queen.IORING_TIMEOUT_BOOTTIMEβ use the boottime clock source, bestie.IORING_TIMEOUT_REALTIMEβ use the realtime clock source instead.IORING_TIMEOUT_ETIME_SUCCESSβ treat an expired timeout as a success when it comes to the posted completion. normally, when a timeout actually triggers, you get back a-ETIMEin the CQEresvalue. with this flag? expired = win. π
and the timeout remove command? she does not currently accept any flags. not one. zero. periodt. π
π«Ά RETURN VALUE π«Ά
None. she gives you nothing back directly, it's giving mysterious. the real tea shows up in the CQE.
π ERRORS π
these are the errors that get reported in the CQE res field. when everything's good, you get 0 back. slay.
-ENOENTβ the timeout identified byuser_datacould not be found. maybe it's invalid, or maybe it already triggered before your update or removal request even got processed. she's gone, bestie. π-EALREADYβ the timeout identified byuser_datais already firing and cannot be canceled. too late, she's mid-main-character-moment.-EINVALβ one of the fields you set in the SQE was invalid. like, for example, you gave two clocksources (pick ONE, girl), or the timeout seconds or nanoseconds you specified were< 0.-EFAULTβ io_uring was unable to access the data specified byts.
π§ NOTES π§
okay this part is important so listen up. as with any request that passes in data in a struct, that data has to stay valid until the request has been successfully submitted. it does not need to stay valid until completion. once a request has been submitted, the in-kernel state is stable. π
very early kernels (5.4 and earlier) were the exception though β they required that state to stay stable all the way until the completion happened. so old-school. if you wanna know whether you're dealing with that behavior, apps can test for it by inspecting the IORING_FEAT_SUBMIT_STABLE flag that gets passed back from io_uring_queue_init_params(3). iykyk πΈ
π SEE ALSO π
and that's the whole page, bestie! this one's from liburing-2.2, dated March 12, 2022 β genuinely iconic of her, no cap. go forth and update your timeouts responsibly, mwah ππ¦π
π¦ where this page comes from
- alpine 3.24: liburing-doc 2.14-r0 Β· LGPL-2.1-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
- ubuntu resolute: liburing-dev 2.14-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2022 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