From patchwork Wed Sep 18 21:16:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1164210 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-105239-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="JxeLmpDb"; 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 46YXq20xjPz9s4Y for ; Thu, 19 Sep 2019 07:16:45 +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=pndKm0bnHNuxjwyyu3re5ZGompYz+ZT IKX4E4M4n5JRrt1nHu57ncrQaNfrLqPjwvhdEbjR1vOuzx8iWmQ81GH9to2XzAH+ Hn0qaYQ/LuW34urNbkQVlxTanLYikjTzOxQXlBH6QMsVagm0PJXgq+KyPeDGM+J9 742xsX5aUtg4= 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=7JHTZmfr0X6Qpk2lp25eE7asKOo=; b=JxeLm pDbMN6MwNyGYYzqOL60H/e9LItuOcft6C7vG8RSMzTAP4AFAZa1u7UQCspM8ESpD OhGsnY43YrTd7A+RRKTtMwcI75gViXUJzh8Y4QkZgC6Tc/R23/wGxpKmljKRWuMA BefLwFAQdDzfHtfweU2QCyEVAzm+WuDqPWtJAs= Received: (qmail 80196 invoked by alias); 18 Sep 2019 21:16: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 80137 invoked by uid 89); 18 Sep 2019 21:16:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=soc, 5, 7, 57 X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Alistair Francis , Alistair Francis , Zack Weinberg Cc: Arnd Bergmann , GNU C Library , Adhemerval Zanella , Florian Weimer , Carlos O'Donell , Stepan Golosunov , Lukasz Majewski Subject: [PATCH v8 1/3] y2038: Introduce internal for glibc struct __timespec64 Date: Wed, 18 Sep 2019 23:16:01 +0200 Message-Id: <20190918211603.8444-2-lukma@denx.de> In-Reply-To: <20190918211603.8444-1-lukma@denx.de> References: <20190918211603.8444-1-lukma@denx.de> This type is a glibc's "internal" type similar to struct timespec but whose tv_sec field is a __time64_t rather than a time_t, which makes it Y2038-proof and usable to pass syscalls between user code and Y2038-proof kernel. To support passing this structure to the kernel - the tv_pad, 32 bit int, has been introduced. The placement of it depends on endianness of the SoC. Tested on x86_64 and ARM. * include/time.h: Add struct __timespec64 definition --- Changes for v8: - Replace #if __WORDSIZE == 64 \ || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) condition with #if __TIMESIZE == 64 to allow usage of struct __timespec64 aliased to timespec on ports supporting 64 bit time API from the outset. Architectures with __TIMESIZE == 32 will use struct __timespec64 with __time64_t tv_sec and __int32_t tv_pad and tv_nsec. Changes for v7: - None Changes for v6: - None Changes for v5: - Reword commit message - Add missing preprocessor condition for x32 (to use timespec instead of __timespec64). Changes for v4: - Change tv_pad's type from named bitfield to 32 bit int Changes for v3: - Replace __TIMESIZE with __WORDSIZE (as architectures with __TIMESIZE==64 will need to use this struct with 32 bit tv_nsec field). - Update in-code comment Changes for v2: - None --- include/time.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/time.h b/include/time.h index dcf91855ad..9792948744 100644 --- a/include/time.h +++ b/include/time.h @@ -5,6 +5,7 @@ # include # include # include