[PATCH v2 25/25] linux: Add futex_waitv

Yury Khrustalev yury.khrustalev@arm.com
Wed Nov 11 10:25:04 GMT 2026


On Tue, Nov 10, 2026 at 12:10:09PM -0300, Adhemerval Zanella wrote:
> Add a wrapper for the futex_waitv system call to <sys/futex.h>:
> 
>   struct futex_waiter
>   {
>     uint64_t val;
>     uint64_t uaddr;
>     uint32_t flags;
>     uint32_t __reserved;
>   };
> 
>   int futex_waitv (const struct futex_waiter *waiters,
>                    unsigned int nwaiters, unsigned int flags,
>                    const struct timespec *abstime, clockid_t clockid);
> 
> It blocks on up to FUTEX_WAITV_MAX (128) futexes at the same time
> until any of them is woken.  On success it returns the array index of
> the woken futex; on failure it returns -1 and sets errno.  The timeout
> is absolute, measured against CLOCK_REALTIME or CLOCK_MONOTONIC.
> 
> The struct futex_waiter has the same layout as the kernel struct
> futex_waitv and each entry carries the kernel FUTEX2_* flags. The only
> extra handling is the negative absolute timeout, which the kernel
> rejects with EINVAL and the wrapper reports as ETIMEDOUT.
> 
> The underlying system call only supports 64-bit time_t and so does the
> wrapper.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> 
> Co-authored-by: Andr� Almeida <andrealmeid@igalia.com>

Patchwork shows regressions on arm32 but I cannot reproduce them.
Tests run successfully on armhf-linux-gnu. Also I see no regressions
on i686-linux-gnu. Might be another false positive.

Kind regards,
Yury



More information about the Libc-alpha mailing list