|
@@ -0,0 +1,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
|
|
|
+
|