io_uring_prep_link_timeout(3)

πŸ“¦
version 2.15 Β· 3 versions
, in alpine 3.24, arch rolling, fedora 44, nixpkgs unstable, ubuntu resolute, ubuntu stonking

ok bestie so real talk, this is io_uring_prep_link_timeout from the liburing manual, section 3 πŸŽ€ and it's giving "timeout but make it linked" energy, and honestly? obsessed.


🌸 NAME 🌸

io_uring_prep_link_timeout β€” a timeout request for linked sqes πŸ’…


✨ SYNOPSIS ✨

#include <liburing.h>

void io_uring_prep_link_timeout(struct io_uring_sqe *sqe,
                                const struct __kernel_timespec *ts,
                                unsigned flags);

πŸ’– DESCRIPTION πŸ’–

so the io_uring_prep_link_timeout(3) function prepares a timeout request for linked sqes, periodt. the submission queue entry sqe gets set up with the timeout you specify in ts, and the flags argument is where you drop your modifier flags that change how the timeout behaves, iykyk.

the ts argument has to be filled in with the right info for your timeout, no cap. it looks like this:

struct __kernel_timespec {
    __kernel_time64_t tv_sec;
    long long tv_nsec;
};

and the flags argument may contain:

  • IORING_TIMEOUT_ABS β€” the value you put in ts is an absolute value, not a relative one. no counting from now, we're picking a specific moment πŸ’…
  • IORING_TIMEOUT_BOOTTIME β€” the boottime clock source should be used. clock vibe check: boottime edition ⭐
  • IORING_TIMEOUT_REALTIME β€” the realtime clock source should be used. clock vibe check: realtime edition πŸ¦‹
  • IORING_TIMEOUT_ETIME_SUCCESS β€” consider an expired timeout a success in terms of the posted completion. it expired and we're choosing to be unbothered ✨
bestie listen, it is invalid to create a chain (linked sqes) consisting only of a link timeout request. like, that's not a thing, don't do it πŸ™ˆ

so here's the tea on how it actually goes down: if all the requests in the chain complete before the timeout, then the link timeout request gets canceled. but upon timeout? all the uncompleted requests in the chain get canceled. the whole chain, girl πŸ’€


🌈 RETURN VALUE 🌈

None. that's it, that's the whole section 🫢


πŸ’œ ERRORS πŸ’œ

these are the errors that get reported in the CQE res field. on success, 0 is returned.

  • -ETIME β€” the specified timeout occurred and triggered the completion event. clock ran out, bestie ⏰
  • -EINVAL β€” one of the fields set in the SQE was invalid. for example, two clock sources were given, or the specified timeout seconds or nanoseconds were < 0. you gave it something cursed, it said no πŸ™…
  • -EFAULT β€” io_uring was unable to access the data specified by ts. couldn't even reach it, tragic 😭
  • -ECANCELED β€” the timeout was canceled because all submitted requests were completed successfully or one of the requests resulted in failure. mission accomplished (or mission flopped), timer's done either way ✨
  • -ENOENT β€” the request to which the linked timeout was linked already completed and could not be found when the timer expired. it went looking for its friend and the friend was already gone πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! this was liburing manual, liburing-2.4 era, dated January 23, 2023 β€” so like, a lil vintage but still iconic πŸ‘‘πŸ’– go prep those linked timeouts, you got this fr fr ✨🌸

πŸ“¦ where this page comes from