Message ID | 20190925002903.15928-2-alistair.francis@wdc.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 115446 invoked by alias); 25 Sep 2019 00:33:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 115384 invoked by uid 89); 25 Sep 2019 00:33:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=Seconds, HContent-Transfer-Encoding:8bit X-HELO: esa1.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1569371613; x=1600907613; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fy/gXMhbzKorslBDcTUk/YyoEgju7u21ky+3x2lefZs=; b=Eg9zgmvNdDJ5/yYLfeLzPk8Jp5/FDVYPfwZvfRR257l6FxDkx006KxGC +4msLlb6YLQK4SbE7/Zmpjoestd5lcNvPuqcXfG7m2FfBzadq2nXP7J77 foREWZSzR88uzHmigJJfIQkgc+ie4wJ5LlPxSrzNZYzv1dbpBMetjZVzy xZmVu1zrGNL0MfI43ew0cR7tPQCuCYL2Rv5Aum5qshPQhoS3uSE75ln0l sdg6kqfAQ6IvlwSmuJtPnY1xKWr3cyitbufPwzQj9wKIxB5Mmr3irwr/9 f9InDkEl4UosO5lxXAv987gjuncdIlTGHczuddgj0SY4QSoZxxiMUzeMz w==; IronPort-SDR: 0PkGYiRTuJFsNEZKGGhXS+AlZPVaQwhoxwQW20xlGb62veNoGzRsTgozMSbZK1+aI0wUFQnP3n 2gwnHVnghWcmStvgPpiU5nHIgpfJHMGSofS85z+lyj3URIkYphSZ3B/XFsfWz8dzxq8VtJ9Jcd 1Qc+AHucDNEzwoK3LLIFtID/XeCP7EWl4PJ1y0tnaeIC3VcK2Q6jGuJ6nLmHOIfVDrnTGK8cbO 7BPGC7miRgRZPBYYIWEFYtauQJ1Cu3IRT0e870Snbjx0CPg8rSWThAge6f65cPDxkQ0bm6CfoT An0= IronPort-SDR: ceEgPThRQy9V+xsFv/z5vHAx5giae8FzTddbdBqqhoOGz+KU92Z8g8TQN7htmVVBu5VdKdNNQK pmfvAB8vxzAGP1oNGgRpLLY7vQV/wxmN38sVY6qN4LuRsdn+ttODWgv71oOj4NE9WsXyxZejZ2 uSwc3S2OYQUKvlLfD1zDiRC2lsWDfKRPSKOHSpJpMzeztdDWZI/1HZlHw3+kVSXJgRyyObOeSl RK5lWk9G8Lk/9Uk42HGHmcoRJG5fNr+Zhv1Dk9ZjhJBGFzh/Ya9hcPfdrxqKMdcNLRes5SJf/6 qd1N8/WZvj5u41j1P33ihlRG IronPort-SDR: Gz3F3oyU7LCYXVWvqDrRwGs6HX1cjeoUXqa1Uu3ddSjjfosG47Y8Fyw3t6viZfGXSXMRdzokXm gskM0leKWvDiMYouYBJOVz92yp48rYBN2GSr//lEaTeAKZ3p4gOtcv2N5MIBsT1rs40qscV9FG NV0N7Uw0cnYS8X8djQUkm3GjT8brqpgEG8Yzo9aAvNq3v3/IfX6nC9mHB/k5Gp001935SUXaM+ Ejt5FHxeGR8z/vfKTnEqOrSOVF+sI87ZaaJqpA8+RM8KEbf4GokPDCvWlxI1Bm5hn1LagGobVd HME= WDCIronportException: Internal From: Alistair Francis <alistair.francis@wdc.com> To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis <alistair.francis@wdc.com> Subject: [PATCH 2/2] time: Add padding for the timespec if required Date: Tue, 24 Sep 2019 17:29:03 -0700 Message-Id: <20190925002903.15928-2-alistair.francis@wdc.com> In-Reply-To: <20190925002903.15928-1-alistair.francis@wdc.com> References: <20190925002903.15928-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Commit Message
Alistair Francis
Sept. 25, 2019, 12:29 a.m. UTC
If we are running on a 32-bit system with a 64-bit time_t we need to ensure there is padding around the tv_nsec variable. This is requried as the timespec is #defined to the __timespec64 struct. 2019-09-20 Alistair Francis <alistair.francis@wdc.com> * time/bits/types/struct_timespec.h: Add padding for the timespec if required. --- This change was tested by running user space tests on RV32. time/bits/types/struct_timespec.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Comments
On Tue, 24 Sep 2019, Alistair Francis wrote: > +#if __WORDSIZE == 64 \ > + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) || \ > + __TIMESIZE == 32 || goes at start of line, not at end of line. > __syscall_slong_t tv_nsec; /* Nanoseconds. */ > +#else > +# if __BYTE_ORDER == __BIG_ENDIAN > + int: 32; /* Padding */ > + long int tv_nsec; /* Nanoseconds */ > +# else > + long int tv_nsec; /* Nanoseconds */ > + int: 32; /* Padding */ > +# endif > +#endif The comment formatting in the other cases, with ". " ('.' and two spaces) at end of comment, is correct GNU style. The patch is OK with those fixes once the <bits/endian.h> changes are reviewed and checked in.
On Tue, Sep 24, 2019 at 5:57 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Tue, 24 Sep 2019, Alistair Francis wrote: > > > +#if __WORDSIZE == 64 \ > > + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) || \ > > + __TIMESIZE == 32 > > || goes at start of line, not at end of line. > > > __syscall_slong_t tv_nsec; /* Nanoseconds. */ > > +#else > > +# if __BYTE_ORDER == __BIG_ENDIAN > > + int: 32; /* Padding */ > > + long int tv_nsec; /* Nanoseconds */ > > +# else > > + long int tv_nsec; /* Nanoseconds */ > > + int: 32; /* Padding */ > > +# endif > > +#endif > > The comment formatting in the other cases, with ". " ('.' and two spaces) > at end of comment, is correct GNU style. I have fixed all of there. > > The patch is OK with those fixes once the <bits/endian.h> changes are > reviewed and checked in. Thanks! :) I don't add a Reviewed-by tag do I? Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
Hi Alistair, Joseph, > On Tue, Sep 24, 2019 at 5:57 PM Joseph Myers > <joseph@codesourcery.com> wrote: > > > > On Tue, 24 Sep 2019, Alistair Francis wrote: > > > > > +#if __WORDSIZE == 64 \ > > > + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) || > > > \ > > > + __TIMESIZE == 32 ^^^^^^^^^^^^^^^^^ - this may be a bit problematic as 32 bit systems (with __TIMESIZE == 32) gain support for 64 bit time (so the Y2038 problem is solved). Those systems also would require padding (the code below). However, I do guess that allowing such systems to have the extra padding after this patch (by removing __TIMESIZE==32 condition) is not an option for now (and shall be done in the same commit which introduces -D_TIME_BITS=64 support to glibc) ? > > > > || goes at start of line, not at end of line. > > > > > __syscall_slong_t tv_nsec; /* Nanoseconds. */ > > > +#else > > > +# if __BYTE_ORDER == __BIG_ENDIAN > > > + int: 32; /* Padding */ > > > + long int tv_nsec; /* Nanoseconds */ > > > +# else > > > + long int tv_nsec; /* Nanoseconds */ > > > + int: 32; /* Padding */ > > > +# endif > > > +#endif > > > > The comment formatting in the other cases, with ". " ('.' and two > > spaces) at end of comment, is correct GNU style. > > I have fixed all of there. > > > > > The patch is OK with those fixes once the <bits/endian.h> changes > > are reviewed and checked in. > > Thanks! :) > > I don't add a Reviewed-by tag do I? > > Alistair > > > > > -- > > Joseph S. Myers > > joseph@codesourcery.com Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
On Wed, 25 Sep 2019, Lukasz Majewski wrote: > > > > +#if __WORDSIZE == 64 \ > > > > + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) || > > > > \ > > > > + __TIMESIZE == 32 > ^^^^^^^^^^^^^^^^^ - this may be a bit problematic as 32 bit > systems (with __TIMESIZE == 32) gain support for 64 bit time > (so the Y2038 problem is solved). > > Those systems also would require padding (the code below). > > However, I do guess that allowing such systems to have the > extra padding after this patch (by removing __TIMESIZE==32 > condition) is not an option for now (and shall be done in the > same commit which introduces -D_TIME_BITS=64 support to glibc) > ? Yes, support for _TIME_BITS=64 should end up as one large commit that adds all the header support, all the function exports and symbol versions, all the ABI baseline updates and all the documentation. (It may well be split into several pieces to review, but should still end up as one commit to avoid intermediate states where some interfaces have _TIME_BITS=64 support and some don't, so compiling with _TIME_BITS=64 gives a broken ABI.)
Hi Joseph, > On Wed, 25 Sep 2019, Lukasz Majewski wrote: > > > > > > +#if __WORDSIZE == 64 \ > > > > > + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == > > > > > 64) || \ > > > > > + __TIMESIZE == 32 > > ^^^^^^^^^^^^^^^^^ - this may be a bit problematic as 32 bit > > systems (with __TIMESIZE == 32) gain support for 64 bit > > time (so the Y2038 problem is solved). > > > > Those systems also would require padding (the code below). > > > > However, I do guess that allowing such systems to have the > > extra padding after this patch (by removing __TIMESIZE==32 > > condition) is not an option for now (and shall be done in > > the same commit which introduces -D_TIME_BITS=64 support to glibc) > > ? > > Yes, support for _TIME_BITS=64 should end up as one large commit that > adds all the header support, all the function exports and symbol > versions, all the ABI baseline updates and all the documentation. > (It may well be split into several pieces to review, but should still > end up as one commit to avoid intermediate states where some > interfaces have _TIME_BITS=64 support and some don't, so compiling > with _TIME_BITS=64 gives a broken ABI.) > Ok. Thanks for clarification. Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h index 5b77c52b4f0..fd6087955ac 100644 --- a/time/bits/types/struct_timespec.h +++ b/time/bits/types/struct_timespec.h @@ -3,13 +3,26 @@ #define _STRUCT_TIMESPEC 1 #include <bits/types.h> +#include <bits/endian.h> /* POSIX.1b structure for a time value. This is like a `struct timeval' but has nanoseconds instead of microseconds. */ struct timespec { __time_t tv_sec; /* Seconds. */ +#if __WORDSIZE == 64 \ + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) || \ + __TIMESIZE == 32 __syscall_slong_t tv_nsec; /* Nanoseconds. */ +#else +# if __BYTE_ORDER == __BIG_ENDIAN + int: 32; /* Padding */ + long int tv_nsec; /* Nanoseconds */ +# else + long int tv_nsec; /* Nanoseconds */ + int: 32; /* Padding */ +# endif +#endif }; #endif