@@ -87,3 +87,4 @@ struct glibc21_stat
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -33,14 +33,14 @@ int
___fxstat64 (int vers, int fd, struct stat64 *buf)
{
int result;
-#ifdef __NR_fstat64
- result = INLINE_SYSCALL (fstat64, 2, fd, buf);
-#else
+#if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
struct statx tmp;
result = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH, STATX_BASIC_STATS,
&tmp);
if (result == 0)
__cp_stat64_statx (buf, &tmp);
+#else
+ result = INLINE_SYSCALL (fstat64, 2, fd, buf);
#endif
return result;
}
@@ -38,15 +38,15 @@ __fxstatat64 (int vers, int fd, const char *file, struct stat64 *st, int flag)
int result;
-#ifdef __NR_fstatat64
- result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag);
-#else
+#if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstatat64)
struct statx tmp;
result = INTERNAL_SYSCALL_CALL (statx, fd, file, AT_NO_AUTOMOUNT | flag,
STATX_BASIC_STATS, &tmp);
if (result == 0)
__cp_stat64_statx (st, &tmp);
+#else
+ result = INTERNAL_SYSCALL_CALL (fstatat64, fd, file, st, flag);
#endif
if (!__glibc_likely (INTERNAL_SYSCALL_ERROR_P (result)))
return 0;
@@ -28,3 +28,10 @@
#endif
#define STATFS_IS_STATFS64 0
+
+/* Allows asm-generic ABI ports with fstat64 syscall to use statx syscall for
+ implement stat* wrappers. This is needed when glibc stat64 is not compatible
+ with kernel stat64 (due to 64-bit time_t). By default it is off unless
+ arch opts-in. */
+
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -36,14 +36,14 @@ __fxstat (int vers, int fd, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
{
-# ifdef __NR_fstat64
- int rc = INLINE_SYSCALL (fstat64, 2, fd, buf);
-# else
+# if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
struct statx tmp;
int rc = INLINE_SYSCALL (statx, 5, fd, "", AT_EMPTY_PATH,
STATX_BASIC_STATS, &tmp);
if (rc == 0)
__cp_stat64_statx ((struct stat64 *)buf, &tmp);
+# else
+ int rc = INLINE_SYSCALL (fstat64, 2, fd, buf);
# endif
return rc ?: stat_overflow (buf);
}
@@ -36,15 +36,15 @@ __fxstatat (int vers, int fd, const char *file, struct stat *buf, int flag)
{
if (vers == _STAT_VER_KERNEL)
{
-# ifdef __NR_fstatat64
- int rc = INLINE_SYSCALL (fstatat64, 4, fd, file, buf, flag);
-# else
+# if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
struct statx tmp;
int rc = INLINE_SYSCALL (statx, 5, fd, file,
AT_NO_AUTOMOUNT | flag,
STATX_BASIC_STATS, &tmp);
if (rc == 0)
__cp_stat64_statx ((struct stat64 *)buf, &tmp);
+# else
+ int rc = INLINE_SYSCALL (fstatat64, 4, fd, file, buf, flag);
# endif
return rc ?: stat_overflow (buf);
}
@@ -35,17 +35,17 @@ __lxstat (int vers, const char *name, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
{
-#ifdef __NR_fstatat64
- int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
- AT_SYMLINK_NOFOLLOW);
-#else
+# if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
struct statx tmp;
int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name,
AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW,
STATX_BASIC_STATS, &tmp);
if (rc == 0)
__cp_stat64_statx ((struct stat64 *)buf, &tmp);
-#endif
+# else
+ int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
+ AT_SYMLINK_NOFOLLOW);
+# endif
return rc ?: stat_overflow (buf);
}
errno = EINVAL;
@@ -40,10 +40,7 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
{
if (vers == _STAT_VER_KERNEL)
{
-#ifdef __NR_fstatat64
- return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
- AT_SYMLINK_NOFOLLOW);
-#else
+#if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
struct statx tmp;
int rc = INLINE_SYSCALL (statx, 5, AT_FDCWD, name,
AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW,
@@ -51,6 +48,9 @@ __lxstat64 (int vers, const char *name, struct stat64 *buf)
if (rc == 0)
__cp_stat64_statx (buf, &tmp);
return rc;
+#else
+ return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf,
+ AT_SYMLINK_NOFOLLOW);
#endif
}
@@ -35,14 +35,14 @@ __xstat (int vers, const char *name, struct stat *buf)
{
if (vers == _STAT_VER_KERNEL)
{
-# ifdef __NR_fstatat64
- int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
-# else
+# if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
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 ((struct stat64 *)buf, &tmp);
+# else
+ int rc = INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
# endif
return rc ?: stat_overflow (buf);
}
@@ -40,15 +40,15 @@ __xstat64 (int vers, const char *name, struct stat64 *buf)
{
if (vers == _STAT_VER_KERNEL)
{
-#ifdef __NR_fstatat64
- return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
-#else
+#if STAT64_IS_NOT_KERNEL_STAT64 || !defined (__NR_fstat64)
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;
+#else
+ return INLINE_SYSCALL (fstatat64, 4, AT_FDCWD, name, buf, 0);
#endif
}
errno = EINVAL;
@@ -32,3 +32,4 @@ struct kernel_stat {
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -19,3 +19,4 @@
#define STAT_IS_KERNEL_STAT 1
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -36,3 +36,4 @@ struct kernel_stat
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -50,3 +50,4 @@ struct kernel_stat
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -58,3 +58,4 @@ struct kernel_stat
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -49,3 +49,4 @@ struct kernel_stat
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -19,3 +19,4 @@
#define STAT_IS_KERNEL_STAT 1
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -19,3 +19,4 @@
#define STAT_IS_KERNEL_STAT 1
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -33,3 +33,4 @@ struct kernel_stat
#define XSTAT_IS_XSTAT64 0
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -46,3 +46,4 @@ struct kernel_stat64
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0
@@ -22,7 +22,7 @@
#include <statx_cp.h>
-#if !defined(__NR_fstat64) || !defined(__NR_fstatat64)
+#if !defined (__NR_fstat64) || !defined (__NR_fstatat64) || STAT64_IS_NOT_KERNEL_STAT64
void
__cp_stat64_statx (struct stat64 *to, struct statx *from)
{
@@ -19,3 +19,4 @@
#define STAT_IS_KERNEL_STAT 1
#define XSTAT_IS_XSTAT64 1
#define STATFS_IS_STATFS64 0
+#define STAT64_IS_NOT_KERNEL_STAT64 0