Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 1 | Use SYS_futex for syscall |
Andrew Geissler | e34f896 | 2021-04-15 15:53:51 -0500 | [diff] [blame] | 2 | |
| 3 | glibc defines SYS_futex and on newer 32bit CPUs like RISCV-32, arc there |
| 4 | is no 32bit time_t therefore define SYS_futex in terms of SYS_futex_time64 |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 8 | |
| 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 Geissler | e34f896 | 2021-04-15 15:53:51 -0500 | [diff] [blame] | 15 | +/** Newer 32bit CPUs eg. RISCV-32 are defaulting to 64bit time_t from get go and |
| 16 | + therefore do not define __NR_futex */ |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 17 | +# if !defined(SYS_futex) && defined(SYS_futex_time64) |
| 18 | +# define SYS_futex SYS_futex_time64 |
| 19 | +# endif |
Andrew Geissler | e34f896 | 2021-04-15 15:53:51 -0500 | [diff] [blame] | 20 | + |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 21 | # define SRW_FUTEX(a,op,n) \ |
| 22 | syscall(SYS_futex, a, FUTEX_ ## op ## _PRIVATE, n, nullptr, nullptr, 0) |
| 23 | # elif defined __OpenBSD__ |