blob: 3244ab8da2bf50e8a8e34c2687c3ad972d4f65da [file] [log] [blame]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05001Use SYS_futex for syscall
Andrew Geisslere34f8962021-04-15 15:53:51 -05002
3glibc defines SYS_futex and on newer 32bit CPUs like RISCV-32, arc there
4is no 32bit time_t therefore define SYS_futex in terms of SYS_futex_time64
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05008
9--- a/storage/innobase/sync/srw_lock.cc
10+++ b/storage/innobase/sync/srw_lock.cc
11@@ -210,6 +210,12 @@ void ssux_lock_low::wake() { WakeByAddre
12 # ifdef __linux__
13 # include <linux/futex.h>
14 # include <sys/syscall.h>
Andrew Geisslere34f8962021-04-15 15:53:51 -050015+/** Newer 32bit CPUs eg. RISCV-32 are defaulting to 64bit time_t from get go and
16+ therefore do not define __NR_futex */
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050017+# if !defined(SYS_futex) && defined(SYS_futex_time64)
18+# define SYS_futex SYS_futex_time64
19+# endif
Andrew Geisslere34f8962021-04-15 15:53:51 -050020+
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050021 # define SRW_FUTEX(a,op,n) \
22 syscall(SYS_futex, a, FUTEX_ ## op ## _PRIVATE, n, nullptr, nullptr, 0)
23 # elif defined __OpenBSD__