diff options
author | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2017-04-20 09:17:50 +0200 |
---|---|---|
committer | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2017-04-20 16:14:09 +0200 |
commit | 58e63f9d46ec1e0bec4d83d592f0882d251184f9 (patch) | |
tree | 38397f6af30e9b2729b2f410b5aeb2d99a0dbd6c | |
parent | b418390089643c594dcb3313b1bc27c3606c87c6 (diff) | |
download | glibc-58e63f9d46ec1e0bec4d83d592f0882d251184f9.tar.gz |
Add __utimensat64
-rw-r--r-- | io/sys/stat.h | 9 | ||||
-rw-r--r-- | io/utimensat.c | 9 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/Versions | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/utimensat.c | 24 |
4 files changed, 44 insertions, 0 deletions
diff --git a/io/sys/stat.h b/io/sys/stat.h index a2ce904a3d..b3bcca6558 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -360,6 +360,15 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) #ifdef __USE_ATFILE /* Set file access and modification times relative to directory file descriptor. */ +#ifdef __USE_TIME_BITS64 +# if defined(__REDIRECT) +extern int __REDIRECT (utimensat, (int __fd, const char *__path, + const struct timespec __times[2], int __flags), + __utimensat64) __THROW __nonnull((2)); +# else +# define utimensat __utimensat64 +# endif +#endif extern int utimensat (int __fd, const char *__path, const struct timespec __times[2], int __flags) diff --git a/io/utimensat.c b/io/utimensat.c index bc7341f84e..fd51b93422 100644 --- a/io/utimensat.c +++ b/io/utimensat.c @@ -30,3 +30,12 @@ utimensat (int fd, const char *file, const struct timespec tsp[2], return -1; } stub_warning (utimensat) + +int +__utimensat64 (int fd, const char *file, const struct __timespec64 tsp[2], + int flags) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (__utimensat64) diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions index 7e0e217200..7493c8fcce 100644 --- a/sysdeps/unix/sysv/linux/arm/Versions +++ b/sysdeps/unix/sysv/linux/arm/Versions @@ -32,5 +32,7 @@ libc { __clock_nanosleep64; # Y2038-proof futimens API __futimens64; + # Y2038-proof utimensat API + __utimensat64; } } diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c index f3a9697a17..94fd72077a 100644 --- a/sysdeps/unix/sysv/linux/utimensat.c +++ b/sysdeps/unix/sysv/linux/utimensat.c @@ -19,6 +19,8 @@ #include <errno.h> #include <sys/stat.h> #include <sysdep.h> +#include <kernel_timespec.h> +#include <stdio.h> /* Change the access time of FILE to TSP[0] and @@ -41,3 +43,25 @@ utimensat (int fd, const char *file, const struct timespec tsp[2], #ifndef __NR_utimensat stub_warning (utimensat) #endif + +int +__utimensat64 (int fd, const char *file, const struct __timespec64 tsp[2], + int flags) +{ + struct kernel_timespec64 ks[2], *ksp; + if (file == NULL) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); + if (tsp) + { + ks[0].tv_sec = tsp[0].tv_sec; + ks[0].tv_nsec = tsp[0].tv_nsec; + ks[1].tv_sec = tsp[1].tv_sec; + ks[1].tv_nsec = tsp[1].tv_nsec; + ksp = ks; + } + else + { + ksp = NULL; + } + return INLINE_SYSCALL (utimensat64, 4, fd, file, ksp, flags); +} |