diff options
Diffstat (limited to 'libc/sysdeps/linux/common/fstat.c')
-rw-r--r-- | libc/sysdeps/linux/common/fstat.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/fstat.c b/libc/sysdeps/linux/common/fstat.c index 030360dfc..65e879799 100644 --- a/libc/sysdeps/linux/common/fstat.c +++ b/libc/sysdeps/linux/common/fstat.c @@ -10,10 +10,11 @@ #include <unistd.h> #include <sys/stat.h> #include <sys/syscall.h> +#include <bits/uClibc_arch_features.h> #include "xstatconv.h" -#if defined __NR_fstat64 && !defined __NR_fstat +#if defined __NR_fstat64 && !defined __NR_fstat && !defined(__UCLIBC_USE_TIME64__) int fstat(int fd, struct stat *buf) { return INLINE_SYSCALL(fstat64, 2, fd, buf); @@ -29,6 +30,22 @@ int fstat(int fd, struct stat *buf) } libc_hidden_def(fstat) +#elif defined __NR_statx && defined __UCLIBC_HAVE_STATX__ +# include <fcntl.h> +# include <statx_cp.h> + +int fstat(int fd, struct stat *buf) +{ + struct statx tmp; + int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH, + STATX_BASIC_STATS, &tmp); + if (rc == 0) + __cp_stat_statx ((struct stat *)buf, &tmp); + + return rc; +} +libc_hidden_def(fstat) + #elif defined __NR_fstat int fstat(int fd, struct stat *buf) { @@ -57,7 +74,7 @@ int fstat(int fd, struct stat *buf) libc_hidden_def(fstat) #endif -# if ! defined __NR_fstat64 +# if ! defined __NR_fstat64 && ! defined __UCLIBC_HAVE_STATX__ strong_alias_untyped(fstat,fstat64) libc_hidden_def(fstat64) #endif |