linux: Disentangle fstatat from fxstatat

System Internals / glibc - Adhemerval Zanella [linaro.org] - 9 October 2020 20:02 UTC

It implements all the required syscall for the all Linux kABIS on fstatat{64} instead of calling fxstatat{64}.

On non-LFS implementation, it handles 3 cases:

1. New kABIs which uses generic pre 64-bit time Linux ABI (csky and nios): it issues __NR_fstat64 plus handle the overflow on st_ino, st_size, or st_blocks.

2. Old KABIs with old non-LFS support (arm, i386, hppa, m68k, microblaze, mips32, s390, sh, powerpc, and sparc32): it issues __NR_fstatat64 and convert the result to struct stat.

3. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat.

The generic LFS implementation handles multiple cases:

1. XSTAT_IS_XSTAT64 being 1:

1.1. 64-bit kABI (aarch64, ia64, powerpc64*, s390x, riscv64, and x86_64): it issues __NR_newfstatat.

1.2. 64-bit kABI outlier (alpha): it issues __NR_fstatat64.

1.3. 64-bit kABI outlier where struct stat64 does not match kernel one (sparc64): it issues __NR_fstatat64 and convert the result to struct stat64.

1.4. 32-bit kABI with default 64-bit time_t (arc, riscv32): it issues __NR_statx and convert the result to struct stat64.

2. Old ABIs with XSTAT_IS_XSTAT64 being 0:

2.1. All kABIs with non-LFS support (arm, csky, i386, hppa, m68k, microblaze, nios2, sh, powerpc32, and sparc32): it issues __NR_fstatat64.

2.2. 64-bit kABI outliers (mips64 and mips64-n32): it issues __NR_newfstatat and convert the result to struct stat64.

It allows to remove all the hidden definitions from the {f,l}xstat{64} (some are still kept because Hurd requires it).

Checked with a build for all affected ABIs. I also checked on x86_64, i686, powerpc, powerpc64le, sparcv9, sparc64, s390, and s390x.

6073bae64c linux: Disentangle fstatat from fxstatat
include/sys/stat.h | 32 ++++++++--
sysdeps/unix/sysv/linux/alpha/fxstat64.c | 2 -
sysdeps/unix/sysv/linux/alpha/fxstatat64.c | 4 --
sysdeps/unix/sysv/linux/alpha/lxstat64.c | 3 -
sysdeps/unix/sysv/linux/alpha/xstat64.c | 3 -
sysdeps/unix/sysv/linux/fstatat.c | 54 +++++++++++++++-
sysdeps/unix/sysv/linux/fstatat64.c | 43 ++++++++++++-
sysdeps/unix/sysv/linux/fxstat.c | 1 -
sysdeps/unix/sysv/linux/fxstat64.c | 3 -
sysdeps/unix/sysv/linux/fxstatat.c | 2 -
sysdeps/unix/sysv/linux/fxstatat64.c | 4 +-
sysdeps/unix/sysv/linux/kstat_cp.h | 2 +
sysdeps/unix/sysv/linux/lxstat.c | 1 -
sysdeps/unix/sysv/linux/lxstat64.c | 2 -
sysdeps/unix/sysv/linux/mips/fxstat.c | 1 -
sysdeps/unix/sysv/linux/mips/lxstat.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/fxstat64.c | 2 -
sysdeps/unix/sysv/linux/mips/mips64/fxstatat.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/fxstatat64.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/kstat_cp.h | 80 ++++++++++++++++++++++++
sysdeps/unix/sysv/linux/mips/mips64/lxstat64.c | 2 -
sysdeps/unix/sysv/linux/mips/mips64/xstat64.c | 2 -
sysdeps/unix/sysv/linux/mips/xstat.c | 1 -
sysdeps/unix/sysv/linux/sparc/sparc64/kstat_cp.h | 46 ++++++++++++++
sysdeps/unix/sysv/linux/xstat.c | 1 -
sysdeps/unix/sysv/linux/xstat64.c | 2 -
26 files changed, 251 insertions(+), 45 deletions(-)

Upstream: sourceware.org


  • Share