From patchwork Wed Mar 4 14:19:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1249030 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-110259-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=Gyh8udvC; 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 48Xbcq1Qn0z9sSG for ; Thu, 5 Mar 2020 01:20:10 +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 :mime-version:content-transfer-encoding; q=dns; s=default; b=OaG 9GNm1O7dogb4VfSFTbXsbpjqxEgChE6CuJeQfs1sDzNsraxKOXdDAxpBWr7Vjsqy kLW8GJnpUljVMTc+xrhia25YMUFxoH5Ra5mwcUi8cdfnHCIu/r6I91ISo/njdEWU ajyTKY3TT7J6WXU8BaPDI0sb/o/gKxAvjRkW1iKI= 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 :mime-version:content-transfer-encoding; s=default; bh=fl0PpK6w3 QnkWs3w7HHWXo4VVPw=; b=Gyh8udvC0nJROUpNcCe6hkzSc+NFVU1hpoIEdDzM3 1e3i9JogsB2b7z1LsmKdZbNQHjhc3qYfL/lYNdlMZiHG1XSN6xa7T+6wno4lPpV9 ntwdG3VTt+ugtwwO/Es63GKXmREfcV8QE3jRux85lzUkynILGtUkUSo4PLAg0CK9 xg= Received: (qmail 64215 invoked by alias); 4 Mar 2020 14:20:03 -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 64197 invoked by uid 89); 4 Mar 2020 14:20:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy= X-HELO: mail-out.m-online.net From: Lukasz Majewski To: Joseph Myers , Paul Eggert , Adhemerval Zanella , Andreas Schwab Cc: Alistair Francis , Alistair Francis , GNU C Library , Siddhesh Poyarekar , Florian Weimer , Florian Weimer , Zack Weinberg , Carlos O'Donell , Lukasz Majewski Subject: [PATCH v3 1/3] y2038: include: Move struct __timespec64 definition to a separate file Date: Wed, 4 Mar 2020 15:19:28 +0100 Message-Id: <20200304141930.16300-1-lukma@denx.de> MIME-Version: 1.0 The struct __timespec64's definition has been moved from ./include/time.h to ./include/bits/types/struct___timespec64.h. This change would prevent from polluting other glibc namespaces (when headers are modified to support 64 bit time on architectures with __WORDSIZE==32). Now it is possible to just include definition of this particular structure when needed. --- Changes for v3: - Rebase to the newest glibc's - master Changes for v2: - New patch - as suggested by Andreas Schwab --- include/bits/types/struct___timespec64.h | 26 ++++++++++++++++++++++++ include/time.h | 24 +--------------------- 2 files changed, 27 insertions(+), 23 deletions(-) create mode 100644 include/bits/types/struct___timespec64.h diff --git a/include/bits/types/struct___timespec64.h b/include/bits/types/struct___timespec64.h new file mode 100644 index 0000000000..0c60f144c8 --- /dev/null +++ b/include/bits/types/struct___timespec64.h @@ -0,0 +1,26 @@ +#ifndef _TIMESPEC64_H +#define _TIMESPEC64_H 1 +# if __TIMESIZE == 64 +# define __timespec64 timespec +# else +# include +/* The glibc Y2038-proof struct __timespec64 structure for a time value. + To keep things Posix-ish, we keep the nanoseconds field a 32-bit + signed long, but since the Linux field is a 64-bit signed int, we + pad our tv_nsec with a 32-bit unnamed bit-field padding. + + As a general rule the Linux kernel is ignoring upper 32 bits of + tv_nsec field. */ +struct __timespec64 +{ + __time64_t tv_sec; /* Seconds */ +# if BYTE_ORDER == BIG_ENDIAN + __int32_t :32; /* Padding */ + __int32_t tv_nsec; /* Nanoseconds */ +# else + __int32_t tv_nsec; /* Nanoseconds */ + __int32_t :32; /* Padding */ +# endif +}; +# endif +#endif diff --git a/include/time.h b/include/time.h index 7737be1f7d..69359f1121 100644 --- a/include/time.h +++ b/include/time.h @@ -3,10 +3,10 @@ #ifndef _ISOMAC # include +# include # include # include # include