summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-dbs/mysql/mariadb/sys_futex.patch
blob: 384047221362e9c56b5e3ff052f98b93816691c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 166811dfcfc61e7646275aa993d7d7f4b02d1f49 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 3 Apr 2021 12:40:14 -0700
Subject: [PATCH] Use SYS_futex for syscall

glibc defines SYS_futex and on newer 32bit CPUs like RISCV-32, arc there
is no 32bit time_t therefore define SYS_futex in terms of SYS_futex_time64

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 storage/innobase/sync/srw_lock.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc
index 28b586de..3ee71142 100644
--- a/storage/innobase/sync/srw_lock.cc
+++ b/storage/innobase/sync/srw_lock.cc
@@ -226,6 +226,12 @@ void ssux_lock_impl<spinloop>::wake() noexcept { WakeByAddressSingle(&readers);
 #  ifdef __linux__
 #   include <linux/futex.h>
 #   include <sys/syscall.h>
+/** Newer 32bit CPUs eg. RISCV-32 are defaulting to 64bit time_t from get go and
+ therefore do not define __NR_futex */
+#   if !defined(SYS_futex) && defined(SYS_futex_time64)
+#    define SYS_futex SYS_futex_time64
+#   endif
+
 #   define SRW_FUTEX(a,op,n) \
     syscall(SYS_futex, a, FUTEX_ ## op ## _PRIVATE, n, nullptr, nullptr, 0)
 #  elif defined __OpenBSD__