io: Do not implement fstat with fstatat
commit551101e8240b7514fc646d1722f8b79c90362b8f
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 11 Sep 2023 13:25:48 +0000 (11 10:25 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 27 Sep 2023 12:30:24 +0000 (27 09:30 -0300)
tree350c748f6d9bf80e3cacf581fe3a7fed7d94fd9f
parent64b1a44183a3094672ed304532bedb9acc707554
io: Do not implement fstat with fstatat

AT_EMPTY_PATH is a requirement to implement fstat over fstatat,
however it does not prevent the kernel to read the path argument.
It is not an issue, but on x86-64 with SMAP-capable CPUs the kernel is
forced to perform expensive user memory access.  After that regular
lookup is performed which adds even more overhead.

Instead, issue the fstat syscall directly on LFS fstat implementation
(32 bit architectures will still continue to use statx, which is
required to have 64 bit time_t support).  it should be even a
small performance gain on non x86_64, since there is no need
to handle the path argument.

Checked on x86_64-linux-gnu.
sysdeps/unix/sysv/linux/fstat64.c
sysdeps/unix/sysv/linux/fstatat64.c
sysdeps/unix/sysv/linux/internal-stat.h [new file with mode: 0644]