From patchwork Sun Jan 26 14:52:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 37547 Received: (qmail 40380 invoked by alias); 26 Jan 2020 14:53:33 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 40228 invoked by uid 89); 26 Jan 2020 14:53:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=east X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella Cc: Alistair Francis , Alistair Francis , GNU C Library , Siddhesh Poyarekar , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell , Andreas Schwab , Lukasz Majewski Subject: [PATCH v2 5/5] y2038: linux: Provide __settimeofday64 implementation Date: Sun, 26 Jan 2020 15:52:58 +0100 Message-Id: <20200126145258.32643-5-lukma@denx.de> In-Reply-To: <20200126145258.32643-1-lukma@denx.de> References: <20200126145258.32643-1-lukma@denx.de> MIME-Version: 1.0 This patch provides new __settimeofday64 explicit 64 bit function for setting 64 bit time in the kernel (by internally calling __clock_settime64). Moreover, a 32 bit version - __settimeofday has been refactored to internally use __settimeofday64. The __settimeofday is now supposed to be used on systems still supporting 32 bit time (__TIMESIZE != 64) - hence the necessary conversion of struct timeval to 64 bit struct __timespec64. Internally the settimeofday uses __settimeofday64. This patch is necessary for having architectures with __WORDSIZE == 32 Y2038 safe. Build tests: ./src/scripts/build-many-glibcs.py glibcs Run-time tests: - Run specific tests on ARM/x86 32bit systems (qemu): https://github.com/lmajewski/meta-y2038 and run tests: https://github.com/lmajewski/y2038-tests/commits/master Above tests were performed with Y2038 redirection applied as well as without to test proper usage of both __settimeofday64 and __settimeofday. --- Changes for v2: - The conversion to support 64 bit time for settimeofday() has been moved from ./time/settimeofday.c to sysdeps/unix/sysv/linux/settimeofday.c (as suggested by Adhemerval) to avoid the need to create __clock_settime64() method for HURD (as 64 bit time support for machines with __WORDSIZE=32 and __TIMESIZE=32 is now developed solely for Linux). --- include/time.h | 9 +++++ sysdeps/unix/sysv/linux/settimeofday.c | 53 ++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/settimeofday.c diff --git a/include/time.h b/include/time.h index 9166354150..42b393003b 100644 --- a/include/time.h +++ b/include/time.h @@ -8,6 +8,7 @@ # include