From patchwork Mon Apr 29 10:46:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1092581 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101646-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.b="qwvWzmAB"; 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 44t1Z050fFz9s9G for ; Mon, 29 Apr 2019 20:47:04 +1000 (AEST) 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; q=dns; s=default; b=ZdIhRhEhd9nu6XeV0WnaJzc7XfJH+un /rMwHGxxmw/TLOdDgtz3JKTTUdR90fO24tuzb5dnzJfhwBdFAcsY2T53A2HFaOJM dbkILRJocW9jKc7ba69Y3AWB0JBT5aJ/cH44gtIh9M9ZQuwOq5v+Q2a3HSFsdJJR 2GYL6ugPb/8g= 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; s=default; bh=tKXxE/SROdGRgh7YuM3JUMYC1Eg=; b=qwvWz mABfn8LiGybLhL6fB1UDFz6opoliiHjZEOZMLnR4BqIeTXg4YfWg6IvR4SkGy0OP M9U2EfEWtHNPWVOd3mybAIHe9LMEbt9DZetIjRIpPeUzGM6pipFLp6PeIC9vsxwN 76WZBBYNdxXtkKtUgShfKCdo4E3F0nne2iWLtA= Received: (qmail 97269 invoked by alias); 29 Apr 2019 10:46:43 -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 97201 invoked by uid 89); 29 Apr 2019 10:46:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=H*Ad:D*ucla.edu, goal, H*r:192.168.8, H*Ad:D*edu X-HELO: mail-out.m-online.net From: Lukasz Majewski To: libc-alpha@sourceware.org Cc: Stepan Golosunov , Arnd Bergmann , Paul Eggert , Joseph Myers , Lukasz Majewski Subject: [PATCH v2 0/7] y2038: Linux: Provide __clock_* functions supporting 64 bit time Date: Mon, 29 Apr 2019 12:46:06 +0200 Message-Id: <20190429104613.16209-1-lukma@denx.de> In-Reply-To: <20190414220841.20243-1-lukma@denx.de> References: <20190414220841.20243-1-lukma@denx.de> This patch set introduces the conversion of __clock_{settime| gettime|getres|nanosleep} to explicit 64 bit struct __timespec64 arguments. As a result those functions are now Y2038 safe To achieve the above goal - new, internal to glibc, struct __timespec64 has been also introduced as well as helper functions to handle time conversions on 32 bit systems. The code from this patch set uses new clock_* syscalls (explicit 64 bits) from Linux kernel (5.1+) as well. In glibc new __ASSUME_64BIT_TIME define has been introduced to indicate if above syscalls are provided by the kernel. This work is (loosely) based on a previous development/patches: https://libc-alpha.sourceware.narkive.com/zniMOWui/rfc-patch-00-52-make-glibc-y2038-proof#post68 Github branch (including the y2038 conversion example): https://github.com/lmajewski/y2038_glibc/commits/Y2038-2.29-glibc-__clock-internal-struct-timespec-v2 Those patches have been applied on top of master branch: SHA1: c57afec0a9b318bb691e0f5fa4e9681cf30df7a4 Shall be used with provided meta-y2038 for development and testing: https://github.com/lmajewski/meta-y2038 I've used guidelines from: https://www.gnu.org/software/libc/manual/html_mono/libc.html "D.2.1 64-bit time symbol handling in the GNU C Library" to convert *clock_settime*. and most notably from: https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#clock_gettime.28.29 Feedback and comments are more than welcome. Lukasz Majewski (7): y2038: Introduce internal for glibc struct __timespec64 y2038: Introduce __ASSUME_64BIT_TIME define y2038: Provide conversion helpers for struct __timespec64 y2038: linux: Provide __clock_settime64 implementation y2038: linux: Provide __clock_getres64 implementation y2038: linux: Provide __clock_gettime64 implementation y2038: linux: Provide __clock_nanosleep64 implementation include/time.h | 157 ++++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/clock_getres.c | 39 +++++++- sysdeps/unix/sysv/linux/clock_gettime.c | 39 +++++++- sysdeps/unix/sysv/linux/clock_nanosleep.c | 71 +++++++++++++- sysdeps/unix/sysv/linux/clock_settime.c | 50 +++++++++- sysdeps/unix/sysv/linux/kernel-features.h | 14 +++ 6 files changed, 361 insertions(+), 9 deletions(-)