sys_futex_waitv(9)
π sys_futex_waitv β wait on a whole LIST of futexes, bestie
okay so this one is from the Kernel API Manual (section 9, kernel-space girlies rise π) and honestly? it's giving "wait on multiple things at once and see which one pops off first." iconic behaviour fr fr.
β¨ NAME β¨
sys_futex_waitv β wait on a list of futexes. not one. a list. we multitask in this house π
πΈ SYNOPSIS πΈ
long sys_futex_waitv (struct futex_waitv __user * waiters , unsigned int
nr_futexes , unsigned int flags , struct __kernel_timespec __user *
timeout , clockid_t clockid );
like, five whole arguments. she's high maintenance but she delivers π«Ά
π ARGUMENTS π
waitersβ the list of futexes we're waiting on. the whole squad πnr_futexesβ length offutexv. i.e. how many futexes are actually in that list, no cap.flagsβ flag for the timeout (monotonic / realtime). that's literally its whole job.timeoutβ optional absolute timeout. optional!! so if you don't feel like timing out, don't β¨clockidβ the clock used for the timeout: realtime or monotonic. pick your fighter β°
π¦ DESCRIPTION π¦
So you hand it an array of struct futex_waitv, right? And it waits on each uaddr. Every single one. Obsessed with the commitment.
The thread wakes up if a futex_wake is performed at any uaddr. Any of them! first one to wake her up wins the vibe check π₯
Also super important: the syscall returns immediately if any waiter has *uaddr != val. like it's not even gonna try. she said "nope, mismatch, bye" π
*timeout is an optional timeout value for the operation β optional, so no pressure bestie.
Each waiter has its own individual flags. Yes, individually. And the flags argument for the syscall itself should be used solely for specifying the timeout as realtime, if needed. that's it. that's the whole assignment. Flags for private futexes, sizes, etc.? Those go on the individual flags of each waiter. don't mix them up, i'm begging π
So what does it return? It returns the array index of one of the woken futexes. One of them. That's all you get, no further information is provided β and this is the messy part, so sit with me:
- any number of other futexes may also have been woken by the same event π
- if more than one futex was woken, the retrned index may refer to any one of them
- (it is not necessaryily the futex with the smallest index, nor the one most recently woken, norβ¦)
yes, "retrned" and "necessaryily" are literally how it's spelled in the source. she's keeping it real, we don't edit the queen ππ
so like⦠don't build your whole personality on that index meaning something specific. it's a hint, not a promise. periodt.
π SEE ALSO π
- Kernel file
./kernel/futex/syscalls.cβ the mothership, go read it sys_set_robust_list(9)sys_get_robust_list(9)futex_parse_waitv(9)
π cute sign-off π
this lil masterpiece lives in ./kernel/futex, stamped October 2026 in the Kernel API Manual β go off, futex girlies, ily, drink some water and remember to check your uaddr != val before you wait πβ¨ππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms