1From e59e3fc80614a133aac9efd2edbe745977f9468a Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Wed, 11 May 2022 09:02:52 -0700 4Subject: [PATCH] Undefine fstatat64 on musl before calling fstatat64 syscall 5 6Fixes 7 8In file included from ../../base/rand_util_posix.cc:21: 9../../third_party/lss/linux_syscall_support.h:4547:16: error: use of undeclared identifier '__NR_fstatat'; did you mean 'sys_fstatat'? 10 LSS_INLINE _syscall4(int, fstatat64, int, d, 11 ^ 12../../third_party/lss/linux_syscall_support.h:2671:9: note: expanded from macro '_syscall4' 13 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3)); \ 14 ^ 15../../third_party/lss/linux_syscall_support.h:2640:39: note: expanded from macro 'LSS_BODY' 16 : "i"(__NR_##name) , ## args \ 17 ^ 18<scratch space>:222:1: note: expanded from here 19__NR_fstatat 20^ 21../../third_party/lss/linux_syscall_support.h:4547:16: note: 'sys_fstatat' declared here 22../../third_party/lss/linux_syscall_support.h:2668:12: note: expanded from macro '_syscall4' 23 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ 24 ^ ../../third_party/lss/linux_syscall_support.h:1901:28: note: expanded from macro 'LSS_NAME' 25 #define LSS_NAME(name) sys_##name 26 ^ 27<scratch space>:213:1: note: expanded from here 28sys_fstatat 29^ 30 31Upstream-Status: Inappropriate [musl specific] 32Signed-off-by: Khem Raj <raj.khem@gmail.com> 33 34--- 35 third_party/lss/linux_syscall_support.h | 4 ++++ 36 1 file changed, 4 insertions(+) 37 38diff --git a/third_party/lss/linux_syscall_support.h b/third_party/lss/linux_syscall_support.h 39index 99a4b44491..a0a83a4aa4 100644 40--- a/third_party/lss/linux_syscall_support.h 41+++ b/third_party/lss/linux_syscall_support.h 42@@ -4947,9 +4947,13 @@ struct kernel_statx { 43 # endif 44 #endif 45 #if defined(__NR_fstatat64) 46+ // musl does #define fstatat64 fstatat 47+ #undef fstatat64 48 LSS_INLINE _syscall4(int, fstatat64, int, d, 49 const char *, p, 50 struct kernel_stat64 *, b, int, f) 51+ // set it back like it was 52+ #define fstatat64 fstatat 53 #endif 54 #if defined(__NR_waitpid) 55 // waitpid is polyfilled below when not available. 56