This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCHv3 00/24] ILP32 support in ARM64
- From: Zack Weinberg <zackw at panix dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 17 Feb 2015 13:48:02 -0500
- Subject: Re: [PATCHv3 00/24] ILP32 support in ARM64
- Authentication-results: sourceware.org; auth=none
- References: <CAKCAbMiQh2DVjgB_-By8FN2VN01_BkEoVJQunJ9KhWdYM8wJOw at mail dot gmail dot com> <20150215042302 dot GN23507 at brightrain dot aerifal dot cx> <CAKCAbMi8xZ8x3ECwus2LTvaurA66TLA38KgpOj=cAp7k3UwYvQ at mail dot gmail dot com> <20150215160330 dot GP23507 at brightrain dot aerifal dot cx> <54E38AAD dot 6040308 at panix dot com>
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