From 5b980d4809913088729982865188b754939bcd39 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Fri, 19 Mar 2021 09:51:29 -0300 Subject: linux: Use statx for MIPSn64 MIPSn64 kernel ABI for legacy stat uses unsigned 32 bit for second timestamp, which limits the maximum value to y2106. This patch make mips64 use statx as for 32-bit architectures. Thie __cp_stat64_t64_statx is open coded, its usage is solely on fstatat64 and it avoid the need to redefine the name for mips64 (which will call __cp_stat64_statx since its does not use __stat64_t64 internally). --- sysdeps/unix/sysv/linux/fstatat64.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'sysdeps/unix/sysv/linux/fstatat64.c') diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c index 4d936ee0bb..31d3253044 100644 --- a/sysdeps/unix/sysv/linux/fstatat64.c +++ b/sysdeps/unix/sysv/linux/fstatat64.c @@ -24,9 +24,9 @@ #include #include #include -#include #include #include +#include #if __TIMESIZE == 64 \ && (__WORDSIZE == 32 \ @@ -49,8 +49,28 @@ fstatat64_time64_statx (int fd, const char *file, struct __stat64_t64 *buf, struct statx tmp; int r = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag, STATX_BASIC_STATS, &tmp); - if (r == 0) - __cp_stat64_t64_statx (buf, &tmp); + if (r != 0) + return r; + + *buf = (struct __stat64_t64) { + .st_dev = makedev (tmp.stx_dev_major, tmp.stx_dev_minor), + .st_rdev = makedev (tmp.stx_rdev_major, tmp.stx_rdev_minor), + .st_ino = tmp.stx_ino, + .st_mode = tmp.stx_mode, + .st_nlink = tmp.stx_nlink, + .st_uid = tmp.stx_uid, + .st_gid = tmp.stx_gid, + .st_atime = tmp.stx_atime.tv_sec, + .st_atim.tv_nsec = tmp.stx_atime.tv_nsec, + .st_mtime = tmp.stx_mtime.tv_sec, + .st_mtim.tv_nsec = tmp.stx_mtime.tv_nsec, + .st_ctime = tmp.stx_ctime.tv_sec, + .st_ctim.tv_nsec = tmp.stx_ctime.tv_nsec, + .st_size = tmp.stx_size, + .st_blocks = tmp.stx_blocks, + .st_blksize = tmp.stx_blksize, + }; + return r; } @@ -116,7 +136,8 @@ fstatat64_time64_stat (int fd, const char *file, struct __stat64_t64 *buf, } #if (__WORDSIZE == 32 \ - && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) \ + || defined STAT_HAS_TIME32 # define FSTATAT_USE_STATX 1 #else # define FSTATAT_USE_STATX 0 -- cgit 1.4.1