[PATCHv3 00/24] ILP32 support in ARM64
Zack Weinberg
zackw@panix.com
Tue Feb 17 18:48:00 GMT 2015
On 02/17/2015 01:38 PM, Zack Weinberg wrote:
> typedef __S32_TYPE __nseconds_t;
>
> struct timespec {
> __time_t tv_sec;
> #if __BYTE_ORDER == __BIG_ENDIAN
> __S32_TYPE __unused;
> __nseconds_t tv_nsec;
> #else
> __nseconds_t tv_nsec;
> __S32_TYPE __unused;
> #endif
> };
>
> And then change the kernel not to read or write the __unused field.
It just occurred to me that there's a way to cut the baby in half,
namely bitfields.
struct timespec {
__time_t tv_sec;
#if __BYTE_ORDER == __BIG_ENDIAN
long __unused : 32;
long tv_nsec : 32;
#else
long tv_nsec : 32;
long __unused : 32;
#endif
};
This breaks code which takes pointers to tv_nsec, but I expect that is
vanishingly rare -- certainly much less frequent than printing it with %ld.
zw
More information about the Libc-alpha
mailing list