From patchwork Wed Jan 29 12:59:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1230883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109021-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=pxVtrR2n; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4873WR0ZJ9z9sPK for ; Thu, 30 Jan 2020 00:00:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=yCJCgSMW0PqQ07z0f2HU6Ywd367kb2TinMJvfNkOSfr9MLXMKE0q2 zGL2uCMUoOs4NGCBZCZr1qSZWLVBhcn9Ok6sLwgeeCwzYkVIEALnazHdznDog72E OfEhy1qJq7BwrIgbsYvm1lxOvkY568JfgJkr6FTKYbNKmPXQDtteRk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=xgchBqGQukuFOjN0DpDz88LAOZI=; b=pxVtrR2nCqwZ/QSU5Ne2Ch6hjba9 f9aTm15ChGCFcizQ5MSPXNQRqVoEDgKrcTnfIEMJ9hPgUFtt/UlfhGjN0qv88Upw /UeUGUWuIJTe6bJQqlnwfgU8kvAhJLdhAe/ywhVx2ROey541KhcqFBhZfS+xLlvd E/6uVN3MHjyFqBQ= Received: (qmail 31983 invoked by alias); 29 Jan 2020 12:59:51 -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 31846 invoked by uid 89); 29 Jan 2020 12:59:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 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=hour, 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 v3 6/7] y2038: linux: Provide __settimeofday64 implementation Date: Wed, 29 Jan 2020 13:59:13 +0100 Message-Id: <20200129125914.11221-6-lukma@denx.de> In-Reply-To: <20200129125914.11221-1-lukma@denx.de> References: <20200129125914.11221-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. Reviewed-by: Adhemerval Zanella --- Changes for v3: - None 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 8617114052..0345803db2 100644 --- a/include/time.h +++ b/include/time.h @@ -8,6 +8,7 @@ # include