summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/fstatat64.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/fstatat64.c')
-rw-r--r--libc/sysdeps/linux/common/fstatat64.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/fstatat64.c b/libc/sysdeps/linux/common/fstatat64.c
index 711521a6a..16dbf9215 100644
--- a/libc/sysdeps/linux/common/fstatat64.c
+++ b/libc/sysdeps/linux/common/fstatat64.c
@@ -23,7 +23,7 @@
# define __NR_fstatat64 __NR_newfstatat
#endif
-#ifdef __NR_fstatat64
+#if defined(__NR_fstatat64) && !defined(__UCLIBC_USE_TIME64__)
# include <sys/stat.h>
# include "xstatconv.h"
int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
@@ -43,5 +43,26 @@ int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
}
libc_hidden_def(fstatat64)
#else
+
+#if defined(__NR_statx) && defined(__UCLIBC_HAVE_STATX__)
+# include <sys/stat.h>
+# include <statx_cp.h>
+# include <fcntl.h> // for AT_NO_AUTOMOUNT
+
+int fstatat64(int fd, const char *file, struct stat64 *buf, int flag)
+{
+ struct statx tmp;
+
+ int r = INLINE_SYSCALL(statx, 5, fd, file, AT_NO_AUTOMOUNT | flag,
+ STATX_BASIC_STATS, &tmp);
+
+ if (r == 0)
+ __cp_stat64_statx ((struct stat64 *)buf, &tmp);
+
+ return r;
+}
+libc_hidden_def(fstatat64)
+#endif
+
/* should add emulation with fstat64() and /proc/self/fd/ ... */
#endif