From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2076) id 0608F385BF83; Mon, 6 Apr 2020 21:06:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0608F385BF83 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Lukasz Majewski To: glibc-cvs@sourceware.org Subject: [glibc] y2038: include: Move struct __timespec64 definition to a separate file X-Act-Checkin: glibc X-Git-Author: Lukasz Majewski X-Git-Refname: refs/heads/master X-Git-Oldrev: b9cde4e3aa1ff338da7064daf1386b2f4a7351ba X-Git-Newrev: 390b5a4727924503095327087c5d5f7a369732ef Message-Id: <20200406210618.0608F385BF83@sourceware.org> Date: Mon, 6 Apr 2020 21:06:18 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2020 21:06:18 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=390b5a4727924503095327087c5d5f7a369732ef commit 390b5a4727924503095327087c5d5f7a369732ef Author: Lukasz Majewski Date: Wed Feb 12 10:42:49 2020 +0100 y2038: include: Move struct __timespec64 definition to a separate file The struct __timespec64's definition has been moved from ./include/time.h to ./include/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. Reviewed-by: Adhemerval Zanella Diff: --- include/struct___timespec64.h | 27 +++++++++++++++++++++++++++ include/time.h | 24 +----------------------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/struct___timespec64.h b/include/struct___timespec64.h new file mode 100644 index 0000000000..9abb25c8f7 --- /dev/null +++ b/include/struct___timespec64.h @@ -0,0 +1,27 @@ +#ifndef _STRUCT_TIMESPEC64_H +#define _STRUCT_TIMESPEC64_H + +#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 /* _STRUCT_TIMESPEC64_H */ diff --git a/include/time.h b/include/time.h index 4522fe9c4f..1c103a4cb2 100644 --- a/include/time.h +++ b/include/time.h @@ -3,11 +3,11 @@ #ifndef _ISOMAC # include +# include # include # include # include