| Commit message (Expand) | Author | Files | Lines |
| 2019-07-18 | implement fstatat with SYS_statx, conditional on undersized kstat time•••this commit adds a new backend for fstatat (and thereby the whole stat
family) using the SYS_statx syscall, but conditions the new code on
the kernel stat structure's time fields being smaller than time_t. in
principle that should make it all dead code at present, but mips64 has
a broken stat structure with 32-bit time fields despite having 64-bit
time_t elsewhere, so on mips64 it is a functional change that makes
post-Y2038 filesystem timestamps accessible.
whenever the 32-bit archs end up getting 64-bit time_t, regardless of
how that happens, the changes in this commit will automatically take
effect for them too.
| Rich Felker | 1 | -2/+68 |
| 2019-07-18 | cleanup includes now that stat, lstat no longer make direct syscalls | Rich Felker | 2 | -2/+0 |
| 2019-07-18 | restore property that fstat(AT_FDCWD) fails with EBADF•••AT_FDCWD is not a valid file descriptor, so POSIX requires fstat to
fail with EBADF. if passed to fstatat, the call would spuriously
succeed and return results for the working directory.
| Rich Felker | 1 | -0/+1 |
| 2019-07-18 | remove mips/n32/64 stat struct hacks from syscall machinery•••now that we have a kstat structure decoupled from the public struct
stat, we can just use the broken kernel structures directly and let
the code in fstatat do the translation.
| Rich Felker | 6 | -213/+36 |
| 2019-07-18 | decouple struct stat from kernel type•••presently, all archs/ABIs have struct stat matching the kernel
stat[64] type, except mips/mipsn32/mips64 which do conversion hacks in
syscall_arch.h to work around bugs in the kernel type. this patch
completely decouples them and adds a translation step to the success
path of fstatat. at present, this is just a gratuitous copying, but it
opens up multiple possibilities for future support for 64-bit time_t
on 32-bit archs and for cleaned-up/unified ABIs.
for clarity, the mips hacks are not yet removed in this commit, so the
mips kstat structs still correspond to the output of the hacks in
their syscall_arch.h files, not the raw kernel type. a subsequent
commit will fix this.
| Rich Felker | 17 | -4/+364 |
| 2019-07-18 | refactor all stat functions in terms of fstatat•••equivalent logic for fstat+O_PATH fallback and direct use of
stat/lstat syscalls where appropriate is kept, now in the fstatat
function. this change both improves functionality (now, fstatat forms
equivalent to fstat/lstat/stat will work even on kernels too old to
have the at functions) and localizes direct interfacing with the
kernel stat structure to one file.
| Rich Felker | 4 | -23/+37 |
| 2019-07-18 | remove utterly wrong includes from mips64/n32 bits/stat.h•••these were overlooked during review. bits headers are not allowed to
pull in additional headers (note: that rule is currently broken in
other places but just for endian.h). string.h has no place here
anyway, and including bits/alltypes.h without defining macros to
request types from it is a nop.
| Rich Felker | 2 | -6/+0 |
| 2019-07-17 | use register constraint instead of memory operand for riscv64 atomics•••the "A" constraint is simply for an address expression that's a single
register, but it's not yet supported by clang, and has no advantage
here over just using a register operand for the address. the latter is
actually preferable in the a_cas_p case because it avoids aliasing an
lvalue onto the memory.
| Rich Felker | 1 | -8/+8 |
| 2019-07-17 | fix riscv64 atomic asm constraints•••most egregious problem was the lack of memory clobber and lack of
volatile asm; this made the atomics memory barriers but not compiler
barriers. use of "+r" rather than "=r" for a clobbered temp was also
wrong, since the initial value is indeterminate.
| Rich Felker | 1 | -6/+10 |
| 2019-07-17 | fix riscv64 syscall asm constraint•••having "+r"(a0) is redundant with "0"(a0) in syscalls with at least 1
arg, which is arguably a constraint violation (clang treats it as
such), and an invalid input with indeterminate value in the 0-arg
case. use the "=r"(a0) form instead.
| Rich Felker | 1 | -1/+1 |