[RFC 1/7] y2038: Introduce struct __timespec64

Joseph Myers joseph@codesourcery.com
Wed Mar 27 17:04:00 GMT 2019


On Wed, 27 Mar 2019, Lukasz Majewski wrote:

> User space programs on 32 bit machines use struct timespec, which when
> one passes -D_TIME_BITS==64 -D_FILE_OFFSET_BITS==64 during compilation
> is replaced by struct __timespec64, which correctly handles time after
> Y2038.
> Then glibc functions work on struct __timespec64 and provide results to
> user space program.

By comparison, for _FILE_OFFSET_BITS=64 the headers e.g. continue to 
define "struct stat", but with different contents in that case.  So it 
would be possible to do the same with "struct timespec" rather than 
defining it to __timespec64.

There are arguments either way (e.g. defining timespec to __timespec64 
results in different C++ name mangling when _TIME_BITS=64 is used, which 
may be a good idea).  But given the question recently raised about whether 
__time64_t belongs in the installed headers, there needs to be a careful 
justification given for the particular approach chosen, whichever approach 
it ends up being.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list