This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v2 04/20] include/time.h: Fix conflicting timespec types on 32-bit
- From: Arnd Bergmann <arnd at arndb dot de>
- To: Alistair Francis <alistair dot francis at wdc dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Palmer Dabbelt <palmer at sifive dot com>, macro at wdc dot com, Zong Li <zongbox at gmail dot com>, Zong Li <zong at andestech dot com>, Alistair Francis <alistair23 at gmail dot com>
- Date: Tue, 25 Jun 2019 13:17:18 +0200
- Subject: Re: [RFC v2 04/20] include/time.h: Fix conflicting timespec types on 32-bit
- References: <cover.1561421042.git.alistair.francis@wdc.com> <79521bb1530c313aad9ff019769a88ee10c5b135.1561421042.git.alistair.francis@wdc.com>
On Tue, Jun 25, 2019 at 2:11 AM Alistair Francis
<alistair.francis@wdc.com> wrote:
> --- a/include/time.h
> +++ b/include/time.h
> @@ -53,7 +53,8 @@ extern void __tz_compute (__time64_t timer, struct tm *tm, int use_localtime)
> __THROW attribute_hidden;
>
> #if __WORDSIZE == 64 \
> - || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64)
> + || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \
> + || __TIMESIZE == 64
> # define __timespec64 timespec
> #else
> /* The glibc Y2038-proof struct __timespec64 structure for a time value.
I think you need a bit more here: on 32-bit architectures with 64-bit time_t,
we require padding in 'struct timespec' next to tv_nsec (before or after,
depending on endianess), and I don't see a patch in your series that
changes 'timespec' accordingly.
See also https://sourceware.org/glibc/wiki/Y2038ProofnessDesign#struct_timespec
Arnd