summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-04-19 10:02:59 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-04-20 16:14:08 +0200
commitb418390089643c594dcb3313b1bc27c3606c87c6 (patch)
tree5f96ace3251258252cb8077eb6a525e57e31b499
parent327120ae3dcb21f3d92b40512943a54eab0b522d (diff)
downloadglibc-b418390089643c594dcb3313b1bc27c3606c87c6.tar.gz
Add __futimens64
-rw-r--r--io/futimens.c9
-rw-r--r--io/sys/stat.h8
-rw-r--r--sysdeps/unix/sysv/linux/arm/Versions2
-rw-r--r--sysdeps/unix/sysv/linux/futimens.c15
4 files changed, 34 insertions, 0 deletions
diff --git a/io/futimens.c b/io/futimens.c
index 80465ac2df..f3767fadff 100644
--- a/io/futimens.c
+++ b/io/futimens.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <time.h>
#include <sysdep.h>
+#include <kernel_timespec.h>
/* Change the access time of the file associated with FD to TSP[0] and
@@ -32,3 +33,11 @@ futimens (int fd, const struct timespec tsp[2])
return -1;
}
stub_warning (futimens)
+
+int
+__futimens64 (int fd, const struct __timespec64 tsp[2])
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (__futimens64)
diff --git a/io/sys/stat.h b/io/sys/stat.h
index bf63882c7e..a2ce904a3d 100644
--- a/io/sys/stat.h
+++ b/io/sys/stat.h
@@ -368,6 +368,14 @@ extern int utimensat (int __fd, const char *__path,
#ifdef __USE_XOPEN2K8
/* Set file access and modification times of the file associated with FD. */
+#ifdef __USE_TIME_BITS64
+# if defined(__REDIRECT)
+extern int __REDIRECT (futimens, (int __fd, const struct timespec __times[2]),
+ __futimens64) __THROW;
+# else
+# define futimens __futimens64
+# endif
+#endif
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
#endif
diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions
index ad2abe5672..7e0e217200 100644
--- a/sysdeps/unix/sysv/linux/arm/Versions
+++ b/sysdeps/unix/sysv/linux/arm/Versions
@@ -30,5 +30,7 @@ libc {
__timegm64;
# Y2038-proof clock_nanosleep API
__clock_nanosleep64;
+ # Y2038-proof futimens API
+ __futimens64;
}
}
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index 3176e65eaf..b1fce537f3 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <time.h>
#include <sysdep.h>
+#include <kernel_timespec.h>
/* Change the access time of the file associated with FD to TSP[0] and
@@ -43,3 +44,17 @@ futimens (int fd, const struct timespec tsp[2])
#ifndef __NR_utimensat
stub_warning (futimens)
#endif
+
+int
+__futimens64 (int fd, const struct __timespec64 tsp[2])
+{
+ struct kernel_timespec64 kt[2];
+ if (fd < 0)
+ return INLINE_SYSCALL_ERROR_RETURN_VALUE (EBADF);
+ kt[0].tv_sec = tsp[0].tv_sec;
+ kt[0].tv_nsec = tsp[0].tv_nsec;
+ kt[1].tv_sec = tsp[1].tv_sec;
+ kt[1].tv_nsec = tsp[1].tv_nsec;
+ /* Avoid implicit array coercion in syscall macros. */
+ return INLINE_SYSCALL (utimensat64, 4, fd, NULL, &kt[0], 0);
+}