From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70823 invoked by alias); 7 Sep 2017 22:43:25 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 70742 invoked by uid 89); 7 Sep 2017 22:43:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Hx-languages-length:2480 X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 13/52] Y2038: add function __utimensat64 Date: Thu, 07 Sep 2017 22:43:00 -0000 Message-Id: <20170907224219.12483-14-albert.aribaud@3adev.fr> In-Reply-To: <20170907224219.12483-13-albert.aribaud@3adev.fr> References: <20170907224219.12483-1-albert.aribaud@3adev.fr> <20170907224219.12483-2-albert.aribaud@3adev.fr> <20170907224219.12483-3-albert.aribaud@3adev.fr> <20170907224219.12483-4-albert.aribaud@3adev.fr> <20170907224219.12483-5-albert.aribaud@3adev.fr> <20170907224219.12483-6-albert.aribaud@3adev.fr> <20170907224219.12483-7-albert.aribaud@3adev.fr> <20170907224219.12483-8-albert.aribaud@3adev.fr> <20170907224219.12483-9-albert.aribaud@3adev.fr> <20170907224219.12483-10-albert.aribaud@3adev.fr> <20170907224219.12483-11-albert.aribaud@3adev.fr> <20170907224219.12483-12-albert.aribaud@3adev.fr> <20170907224219.12483-13-albert.aribaud@3adev.fr> X-SW-Source: 2017-09/txt/msg00329.txt.bz2 Signed-off-by: Albert ARIBAUD (3ADEV) --- io/utimensat.c | 9 +++++++++ sysdeps/unix/sysv/linux/arm/Versions | 1 + sysdeps/unix/sysv/linux/utimensat.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/io/utimensat.c b/io/utimensat.c index f45eb73b93..6b9cf43d4b 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 08dfae2b61..2620d81fdc 100644 --- a/sysdeps/unix/sysv/linux/arm/Versions +++ b/sysdeps/unix/sysv/linux/arm/Versions @@ -34,5 +34,6 @@ libc { __clock_getres64; __clock_nanosleep64; __futimens64; + __utimensat64; } } diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c index 87f1ef04e0..baa718686e 100644 --- a/sysdeps/unix/sysv/linux/utimensat.c +++ b/sysdeps/unix/sysv/linux/utimensat.c @@ -19,6 +19,7 @@ #include #include #include +#include /* Change the access time of FILE to TSP[0] and @@ -34,3 +35,38 @@ utimensat (int fd, const char *file, const struct timespec tsp[2], /* Avoid implicit array coercion in syscall macros. */ return INLINE_SYSCALL (utimensat, 4, fd, file, &tsp[0], flags); } + +/* 64-bit time version */ + +extern int __y2038_linux_support; + +int +__utimensat64 (int fd, const char *file, const struct __timespec64 tsp[2], + int flags) +{ + struct __timespec64 ts64[2]; + struct timespec ts32[2]; + + if (file == NULL) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); + + if (!tsp) + return INLINE_SYSCALL (utimensat64, 4, fd, file, NULL, flags); + + if (__y2038_linux_support) + { + ts64[0].tv_sec = tsp[0].tv_sec; + ts64[0].tv_nsec = tsp[0].tv_nsec; + ts64[0].tv_pad = 0; + ts64[1].tv_sec = tsp[1].tv_sec; + ts64[1].tv_nsec = tsp[1].tv_nsec; + ts64[1].tv_pad = 0; + return INLINE_SYSCALL (utimensat64, 4, fd, file, &ts64, flags); + } + + ts32[0].tv_sec = tsp[0].tv_sec; + ts32[0].tv_nsec = tsp[0].tv_nsec; + ts32[1].tv_sec = tsp[1].tv_sec; + ts32[1].tv_nsec = tsp[1].tv_nsec; + return INLINE_SYSCALL (utimensat, 4, fd, file, &ts32, flags); +} -- 2.11.0