1*4882a593SmuzhiyunFrom 308746ac207de4f1c3429d6e61ff071809378b70 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Khem Raj <raj.khem@gmail.com>
3*4882a593SmuzhiyunDate: Mon, 26 Oct 2020 22:10:02 -0700
4*4882a593SmuzhiyunSubject: [PATCH] Define __NR_futex if it does not exist
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun__NR_futex is not defines by newer architectures e.g. arc, riscv32 as
7*4882a593Smuzhiyunthey only have 64bit variant of time_t. Glibc defines SYS_futex interface based on
8*4882a593Smuzhiyun__NR_futex, since this is used in applications, such applications start
9*4882a593Smuzhiyunto fail to build for these newer architectures. This patch defines a
10*4882a593Smuzhiyunfallback to alias __NR_futex to __NR_futex_tim64 so SYS_futex keeps
11*4882a593Smuzhiyunworking
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunUpstream-Status: Pending
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSigned-off-by: Khem Raj <raj.khem@gmail.com>
16*4882a593Smuzhiyun---
17*4882a593Smuzhiyun src/corelib/thread/qfutex_p.h | 3 +++
18*4882a593Smuzhiyun 1 file changed, 3 insertions(+)
19*4882a593Smuzhiyun
20*4882a593Smuzhiyundiff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
21*4882a593Smuzhiyunindex f287b752d7..fa5307a604 100644
22*4882a593Smuzhiyun--- a/src/corelib/thread/qfutex_p.h
23*4882a593Smuzhiyun+++ b/src/corelib/thread/qfutex_p.h
24*4882a593Smuzhiyun@@ -76,6 +76,9 @@ QT_END_NAMESPACE
25*4882a593Smuzhiyun #  include <unistd.h>
26*4882a593Smuzhiyun #  include <asm/unistd.h>
27*4882a593Smuzhiyun #  include <linux/futex.h>
28*4882a593Smuzhiyun+#  if !defined(__NR_futex) && defined(__NR_futex_time64)
29*4882a593Smuzhiyun+#    define __NR_futex __NR_futex_time64
30*4882a593Smuzhiyun+#  endif
31*4882a593Smuzhiyun #  define QT_ALWAYS_USE_FUTEX
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun // if not defined in linux/futex.h
34