[v2] linux: use statx for fstat if neither newfstatat nor fstatat64 is present

Message ID 20220601021228.706531-1-git@xen0n.name
State Committed
Commit e6547d635b991651600fab31f788ed5facd77610
Delegated to: Adhemerval Zanella Netto
Headers
Series [v2] linux: use statx for fstat if neither newfstatat nor fstatat64 is present |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

WANG Xuerui June 1, 2022, 2:12 a.m. UTC
  LoongArch is going to be the first architecture supported by Linux that
has neither fstat* nor newfstatat [1], instead exclusively relying on
statx. So in fstatat64's implementation, we need to also enable statx
usage if neither fstatat64 nor newfstatat is present, to prepare for
this new case of kernel ABI.

[1]: https://lore.kernel.org/all/20220518092619.1269111-1-chenhuacai@loongson.cn/

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---

v2: add R-b tag

P.S. I don't have commit access so I need someone else to commit this for
me. Also this would need to get in before the LoongArch port, otherwise
it will fail to build here.

 sysdeps/unix/sysv/linux/fstatat64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c
index 2ab914380d..8b1a1a290d 100644
--- a/sysdeps/unix/sysv/linux/fstatat64.c
+++ b/sysdeps/unix/sysv/linux/fstatat64.c
@@ -42,7 +42,8 @@  _Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t),
 
 #if (__WORDSIZE == 32 \
      && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) \
-     || defined STAT_HAS_TIME32
+     || defined STAT_HAS_TIME32 \
+     || (!defined __NR_newfstatat && !defined __NR_fstatat64)
 # define FSTATAT_USE_STATX 1
 
 static inline int