summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2017-09-08 00:41:57 +0200
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>2018-03-04 16:55:46 +0100
commitebc17efcd97185e107ab25ef616c6ac1c85fc7c6 (patch)
tree2e5ca5a596860848cae90ee2eff09455258dc1b7
parentfe65fb11a1f9cf3a43b7755b8ccc2e1f10ce56f2 (diff)
downloadglibc-ebc17efcd97185e107ab25ef616c6ac1c85fc7c6.tar.gz
Y2038: add function __utimes_t64
-rw-r--r--include/sys/time.h7
-rw-r--r--misc/utimes.c15
-rw-r--r--sysdeps/unix/sysv/linux/utimes.c31
-rw-r--r--time/Versions1
4 files changed, 54 insertions, 0 deletions
diff --git a/include/sys/time.h b/include/sys/time.h
index fa8e33fef8..e04c9045f5 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -20,6 +20,9 @@
# include <time/sys/time.h>
# ifndef _ISOMAC
+
+# include <include/time.h>
+
extern int __gettimeofday (struct timeval *__tv,
struct timezone *__tz);
libc_hidden_proto (__gettimeofday)
@@ -40,5 +43,9 @@ extern int __utimes (const char *__file, const struct timeval __tvp[2])
extern int __futimes (int fd, const struct timeval tvp[2]) attribute_hidden;
extern struct tm * __localtime64 (const __time64_t *__timer);
+
+extern int __utimes_t64 (const char *file, const struct __timeval64 tvp[2])
+ attribute_hidden;
+
# endif
#endif
diff --git a/misc/utimes.c b/misc/utimes.c
index 0f37ad73ca..e48ff9741f 100644
--- a/misc/utimes.c
+++ b/misc/utimes.c
@@ -37,3 +37,18 @@ __utimes (const char *file, const struct timeval tvp[2])
weak_alias (__utimes, utimes)
stub_warning (utimes)
+
+int
+__utimes_t64 (const char *file, const struct __timeval64 tvp[2])
+{
+ if (file == NULL)
+ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (__utimes_t64)
diff --git a/sysdeps/unix/sysv/linux/utimes.c b/sysdeps/unix/sysv/linux/utimes.c
index 09790b21ab..2a2df1176d 100644
--- a/sysdeps/unix/sysv/linux/utimes.c
+++ b/sysdeps/unix/sysv/linux/utimes.c
@@ -34,3 +34,34 @@ __utimes (const char *file, const struct timeval tvp[2])
}
weak_alias (__utimes, utimes)
+
+/* 64-bit time version */
+
+extern int __y2038_linux_support;
+
+int
+__utimes_t64 (const char *file, const struct __timeval64 tvp[2])
+{
+ struct timeval tv32[2], *tvp32 = NULL;
+
+ if (__y2038_linux_support)
+ {
+ /* TODO: implement using 64-bit time syscall */
+ }
+
+ if (tvp != NULL)
+ {
+ if (tvp[0].tv_sec > INT_MAX || tvp[1].tv_sec > INT_MAX)
+ {
+ __set_errno(EOVERFLOW);
+ return -1;
+ }
+ tv32[0].tv_sec = tvp[0].tv_sec;
+ tv32[0].tv_usec = tvp[0].tv_usec;
+ tv32[1].tv_sec = tvp[1].tv_sec;
+ tv32[1].tv_usec = tvp[1].tv_usec;
+ tvp32 = tv32;
+ }
+
+ return INLINE_SYSCALL (utimes, 2, file, tvp32);
+}
diff --git a/time/Versions b/time/Versions
index 1542a1b22f..658abd0904 100644
--- a/time/Versions
+++ b/time/Versions
@@ -86,5 +86,6 @@ libc {
__lutimes64;
__time_t64;
__stime_t64;
+ __utimes_t64;
}
}