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