diff options
Diffstat (limited to 'libc/sysdeps/linux/common/stat.c')
-rw-r--r-- | libc/sysdeps/linux/common/stat.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/libc/sysdeps/linux/common/stat.c b/libc/sysdeps/linux/common/stat.c index 6489d229b..42f39aea6 100644 --- a/libc/sysdeps/linux/common/stat.c +++ b/libc/sysdeps/linux/common/stat.c @@ -9,10 +9,11 @@ #include <sys/syscall.h> #include <unistd.h> #include <sys/stat.h> +#include <bits/uClibc_arch_features.h> #undef stat -#if defined __NR_fstatat64 && !defined __NR_stat +#if defined __NR_fstatat64 && !defined __NR_stat && !defined(__UCLIBC_USE_TIME64__) # include <fcntl.h> int stat(const char *file_name, struct stat *buf) @@ -25,9 +26,22 @@ int stat(const char *file_name, struct stat *buf) int stat(const char *file_name, struct stat *buf) { - return fstatat64(AT_FDCWD, file_name, buf, 0); + return fstatat64(AT_FDCWD, file_name, (struct stat64 *)buf, 0); } +#elif __NR_statx && defined __UCLIBC_HAVE_STATX__ +# include <fcntl.h> +# include <statx_cp.h> +int stat(const char *file_name, struct stat *buf) +{ + struct statx tmp; + int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, file_name, AT_NO_AUTOMOUNT, + STATX_BASIC_STATS, &tmp); + if (rc == 0) + __cp_stat_statx ((struct stat *)buf, &tmp); + + return rc; +} #else # include "xstatconv.h" @@ -58,7 +72,7 @@ int stat(const char *file_name, struct stat *buf) #endif /* __NR_fstat64 */ libc_hidden_def(stat) -#if ! defined __NR_stat64 && ! defined __NR_fstatat64 +#if ! defined __NR_stat64 && ! defined __NR_fstatat64 && ! defined __UCLIBC_HAVE_STATX__ strong_alias_untyped(stat,stat64) libc_hidden_def(stat64) #endif |