gthread: Fix futex timespec type on 32-bit kernels with 64-bit userspace
The struct timespec
type documented as being passed to the futex()
syscall actually needs to be the kernel’s timespec type. This will be
a different width from the userspace timespec type if running a 64-bit
userspace on a 32-bit kernel.
That mismatch will cause g_cond_wait_until()
to return FALSE
immediately.
No other uses of futex()
in GLib use the timeout argument, so they’re
all OK.
Following a detailed suggestion by Rich Felker, pass a different
timespec type into futex()
if __NR_futex_time64
is defined. That’s
the 64-bit time version of futex()
which was added in kernel 5.1, and
which was only added for 32-bit kernels.
Signed-off-by: Philip Withnall pwithnall@endlessos.org
Fixes: #2634 (closed)