aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/directfb/directfb/0001-os-linux-Fix-build-when-__NR_futex-is-not-available.patch
blob: db4417a3d6d96682ad44783e67ac6b66e8190e80 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From 7df69c3a784ab2cc4770bdb366cf788cdb78099a Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 15 Nov 2020 12:30:41 -0800
Subject: [PATCH] os/linux: Fix build when __NR_futex is not available

Newer architectures like riscv32 do not define __NR_futex intentionally
since it uses 64bit time_t from very beginning, therefore only caters to
futex_time64 syscall

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 lib/direct/os/linux/glibc/system.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/direct/os/linux/glibc/system.c b/lib/direct/os/linux/glibc/system.c
index 373a711..d027a70 100644
--- a/lib/direct/os/linux/glibc/system.c
+++ b/lib/direct/os/linux/glibc/system.c
@@ -36,6 +36,7 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <sys/syscall.h>
 #include <unistd.h>
 
 #include <linux/unistd.h>
@@ -46,6 +47,10 @@
 #include <direct/system.h>
 #include <direct/util.h>
 
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+# define SYS_futex SYS_futex_time64
+#endif
+
 D_LOG_DOMAIN( Direct_Futex, "Direct/Futex", "Direct Futex" );
 D_LOG_DOMAIN( Direct_Trap,  "Direct/Trap",  "Direct Trap" );
 
@@ -239,10 +244,9 @@ direct_futex( int *uaddr, int op, int val, const struct timespec *timeout, int *
      }
 #endif
 
-     ret = syscall( __NR_futex, uaddr, op, val, timeout, uaddr2, val3 );
+     ret = syscall( SYS_futex, uaddr, op, val, timeout, uaddr2, val3 );
      if (ret < 0)
           return errno2result( errno );
 
      return DR_OK;
 }
-
-- 
2.29.2