summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-05-23 23:15:15 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-05-24 10:29:29 +0200
commitfdec50de32c12591a90b533d92bb597446ae1957 (patch)
tree72626f8d3de5ee4e847f1ae36de711500bd379b5
parent072a8a6e5e222214f72668dad2423fd3d141a517 (diff)
downloadglibc-fdec50de32c12591a90b533d92bb597446ae1957.tar.gz
Add __stat64_t64, __fstat64_t64, __xstat64_t64, __fxstat64_t64
-rw-r--r--io/Versions4
-rw-r--r--io/fstat64.c7
-rw-r--r--io/stat64.c7
-rw-r--r--io/sys/stat.h39
-rw-r--r--sysdeps/unix/sysv/linux/fxstat64.c19
-rw-r--r--sysdeps/unix/sysv/linux/xstat64.c19
6 files changed, 91 insertions, 4 deletions
diff --git a/io/Versions b/io/Versions
index 64316cd025..d84ecef077 100644
--- a/io/Versions
+++ b/io/Versions
@@ -125,4 +125,8 @@ libc {
GLIBC_2.23 {
fts64_children; fts64_close; fts64_open; fts64_read; fts64_set;
}
+ GLIBC_PRIVATE {
+ __xstat64_t64;
+ __fxstat64_t64;
+ }
}
diff --git a/io/fstat64.c b/io/fstat64.c
index 4ede2540ec..6baa5b0230 100644
--- a/io/fstat64.c
+++ b/io/fstat64.c
@@ -50,3 +50,10 @@ fstat64 (int fd, struct stat64 *buf)
{
return __fxstat64 (_STAT_VER, fd, buf);
}
+
+int
+attribute_hidden
+__fstat64_t64 (int fd, struct __stat64_t64 *buf)
+{
+ return __fxstat64_t64 (_STAT_VER, fd, buf);
+}
diff --git a/io/stat64.c b/io/stat64.c
index 59ad8ee481..eca8484c7f 100644
--- a/io/stat64.c
+++ b/io/stat64.c
@@ -50,3 +50,10 @@ stat64 (const char *file, struct stat64 *buf)
{
return __xstat64 (_STAT_VER, file, buf);
}
+
+int
+attribute_hidden
+__stat64_t64 (const char *file, struct __stat64_t64 *buf)
+{
+ return __xstat64_t64 (_STAT_VER, file, buf);
+}
diff --git a/io/sys/stat.h b/io/sys/stat.h
index b3bcca6558..486dd09d29 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -213,14 +213,27 @@ extern int stat (const char *__restrict __file,
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
# ifdef __REDIRECT_NTH
+# ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
+ struct stat *__restrict __buf), __stat64_t64)
+ __nonnull ((1, 2));
+extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), __fstat64_t64)
+ __nonnull ((2));
+# else
extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf), stat64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
__nonnull ((2));
+# endif
# else
-# define stat stat64
-# define fstat fstat64
+# ifdef __USE_TIME_BITS64
+# define stat stat64_t64
+# define fstat fstat64_t64
+# else
+# define stat stat64
+# define fstat fstat64
+# endif
# endif
#endif
#ifdef __USE_LARGEFILE64
@@ -423,12 +436,21 @@ extern int __fxstatat (int __ver, int __fildes, const char *__filename,
__THROW __nonnull ((3, 4));
#else
# ifdef __REDIRECT_NTH
+# ifdef __USE_TIME_BITS64
+extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
+ struct stat *__stat_buf), __fxstat64_t64)
+ __nonnull ((3));
+extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename,
+ struct stat *__stat_buf), __xstat64_t64)
+ __nonnull ((2, 3));
+# else
extern int __REDIRECT_NTH (__fxstat, (int __ver, int __fildes,
struct stat *__stat_buf), __fxstat64)
__nonnull ((3));
extern int __REDIRECT_NTH (__xstat, (int __ver, const char *__filename,
struct stat *__stat_buf), __xstat64)
__nonnull ((2, 3));
+# endif
extern int __REDIRECT_NTH (__lxstat, (int __ver, const char *__filename,
struct stat *__stat_buf), __lxstat64)
__nonnull ((2, 3));
@@ -438,8 +460,13 @@ extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
__fxstatat64) __nonnull ((3, 4));
# else
-# define __fxstat __fxstat64
-# define __xstat __xstat64
+# ifdef __USE_TIME_BITS64
+# define __fxstat __fxstat64_t64
+# define __xstat __xstat64_t64
+# else
+# define __fxstat __fxstat64
+# define __xstat __xstat64
+# endif
# define __lxstat __lxstat64
# endif
#endif
@@ -447,8 +474,12 @@ extern int __REDIRECT_NTH (__fxstatat, (int __ver, int __fildes,
#ifdef __USE_LARGEFILE64
extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
__THROW __nonnull ((3));
+extern int __fxstat64_t64 (int __ver, int __fildes, struct __stat64_t64 *__stat_buf)
+ __THROW __nonnull ((3));
extern int __xstat64 (int __ver, const char *__filename,
struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
+extern int __xstat64_t64 (int __ver, const char *__filename,
+ struct __stat64_t64 *__stat_buf) __THROW __nonnull ((2, 3));
extern int __lxstat64 (int __ver, const char *__filename,
struct stat64 *__stat_buf) __THROW __nonnull ((2, 3));
extern int __fxstatat64 (int __ver, int __fildes, const char *__filename,
diff --git a/sysdeps/unix/sysv/linux/fxstat64.c b/sysdeps/unix/sysv/linux/fxstat64.c
index 5468dd6c60..2d0cf24108 100644
--- a/sysdeps/unix/sysv/linux/fxstat64.c
+++ b/sysdeps/unix/sysv/linux/fxstat64.c
@@ -24,6 +24,8 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include <xstatconv.h>
+
#include <kernel-features.h>
/* Get information about the file FD in BUF. */
@@ -51,3 +53,20 @@ hidden_ver (___fxstat64, __fxstat64)
strong_alias (___fxstat64, __fxstat64)
hidden_def (__fxstat64)
#endif
+
+int
+__fxstat64_t64 (int vers, int fd, struct __stat64_t64 *buf)
+{
+ int result;
+ struct kernel_stat st64;
+ result = INLINE_SYSCALL (fstat64, 2, fd, &st64);
+#if defined _HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT
+ if (__builtin_expect (!result, 1) && st64.__st_ino != (__ino_t) st64.st_ino)
+ st64.st_ino = st64.__st_ino;
+#endif
+ if (!result)
+ {
+ return __xstat64_conv_t64 (vers, &st64, buf);
+ }
+ return result;
+}
diff --git a/sysdeps/unix/sysv/linux/xstat64.c b/sysdeps/unix/sysv/linux/xstat64.c
index 2075383ddf..b5add12dd5 100644
--- a/sysdeps/unix/sysv/linux/xstat64.c
+++ b/sysdeps/unix/sysv/linux/xstat64.c
@@ -24,6 +24,8 @@
#include <sysdep.h>
#include <sys/syscall.h>
+#include <xstatconv.h>
+
#include <kernel-features.h>
/* Get information about the file NAME in BUF. */
@@ -52,3 +54,20 @@ hidden_ver (___xstat64, __xstat64)
strong_alias (___xstat64, __xstat64)
hidden_def (__xstat64)
#endif
+
+int
+__xstat64_t64 (int vers, const char *name, struct __stat64_t64 *buf)
+{
+ int result;
+ struct kernel_stat st64;
+ result = INLINE_SYSCALL (stat64, 2, name, buf);
+#if defined _HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT
+ if (__builtin_expect (!result, 1) && st64.__st_ino != (__ino_t) st64.st_ino)
+ st64.st_ino = st64.__st_ino;
+#endif
+ if (!result)
+ {
+ return __xstat64_conv_t64 (vers, &st64, buf);
+ }
+ return result;
+}