0007-libdirect-define-__NR_futex-on-32bit-architectures-u.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From 8ffd68a8dfa1e8671dd8c01b96faffd681deca4e Mon Sep 17 00:00:00 2001
  2. From: Steffen Persvold <spersvold@gmail.com>
  3. Date: Tue, 25 Jun 2024 14:14:49 +0200
  4. Subject: [PATCH] libdirect: define __NR_futex on 32bit architectures using
  5. 64-bit time_t
  6. Newer 32bit architectures like RISCV32 and ARC are using 64bit time_t
  7. from the get go unlike other 32bit architectures, therefore aliasing
  8. __NR_futex to __NR_futex_time64 helps avoid the below errors :
  9. system.c:242:21: error: '__NR_futex' undeclared (first use in this function)
  10. 242 | ret = syscall( __NR_futex, uaddr, op, val, timeout, uaddr2, val3 );
  11. | ^~~~~~~~~~
  12. Upstream: dead
  13. Signed-off-by: Steffen Persvold <spersvold@gmail.com>
  14. ---
  15. lib/direct/os/linux/glibc/system.c | 5 ++++-
  16. 1 file changed, 4 insertions(+), 1 deletion(-)
  17. diff --git a/lib/direct/os/linux/glibc/system.c b/lib/direct/os/linux/glibc/system.c
  18. index 32086a25..7143442b 100644
  19. --- a/lib/direct/os/linux/glibc/system.c
  20. +++ b/lib/direct/os/linux/glibc/system.c
  21. @@ -213,6 +213,10 @@ direct_getenv( const char *name )
  22. /**********************************************************************************************************************/
  23. +#if defined(__NR_futex_time64) && !defined(__NR_futex)
  24. +#define __NR_futex __NR_futex_time64
  25. +#endif
  26. +
  27. DirectResult
  28. direct_futex( int *uaddr, int op, int val, const struct timespec *timeout, int *uaddr2, int val3 )
  29. {
  30. @@ -245,4 +249,3 @@ direct_futex( int *uaddr, int op, int val, const struct timespec *timeout, int *
  31. return DR_OK;
  32. }
  33. -
  34. --
  35. 2.40.1