summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c')
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
index ae704958ba..c55b45ebe0 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/xstat64.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/* Hide the prototype for __xstat so that GCC will not complain about
the different function signature if it is aliased to __xstat64.
@@ -32,13 +32,25 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include <statx_cp.h>
+
/* Get information about the file NAME in BUF. */
int
__xstat64 (int vers, const char *name, struct stat64 *buf)
{
if (vers == _STAT_VER_KERNEL)
- return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
-
+ {
+#ifdef __NR_fstatat64
+ return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
+#else
+ struct statx tmp;
+ int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name, AT_NO_AUTOMOUNT,
+ STATX_BASIC_STATS, &tmp);
+ if (rc == 0)
+ __cp_stat64_statx (buf, &tmp);
+ return rc;
+#endif
+ }
errno = EINVAL;
return -1;
}