From: Alistair Francis Date: Wed, 18 Sep 2019 23:51:23 +0000 (-0700) Subject: time: Add padding for the timespec if required X-Git-Tag: changelog-ends-here~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69fd157a3;p=thirdparty%2Fglibc.git time: Add padding for the timespec if required 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. * time/bits/types/struct_timespec.h: Add padding for the timespec if required. --- diff --git a/ChangeLog b/ChangeLog index 17ff0ade2cd..23dc785f30e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2019-10-01 Alistair Francis + + * time/bits/types/struct_timespec.h: Add padding for the timespec if + required. + 2019-10-01 Zack Weinberg Alistair Francis diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h index 5b77c52b4f0..d11c69cfd32 100644 --- a/time/bits/types/struct_timespec.h +++ b/time/bits/types/struct_timespec.h @@ -3,13 +3,26 @@ #define _STRUCT_TIMESPEC 1 #include +#include /* 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