[PATCH 3/5] y2038: inet: Convert inet deadline to support 64 bit time

Adhemerval Zanella adhemerval.zanella@linaro.org
Tue Mar 24 17:56:38 GMT 2020



On 24/03/2020 14:52, Lukasz Majewski wrote:
> Hi Adhemerval,
> 
>> On 24/03/2020 10:18, Lukasz Majewski wrote:
>>> This change brings 64 bit time support to inet deadline related
>>> code for architectures with __WORDSIZE == 32 && __TIMESIZE != 64.
>>>
>>> It is also safe to replace struct timespec with struct __timespec64
>>> in deadline related structures as:
>>>
>>> - The __deadline_to_ms () returns the number of miliseconds to
>>> deadline to be used with __poll (and hence it is a relative value).
>>> - To calculate the deadline from timeval (which will be converted
>>> latter) the uintmax_t type is used (unsinged long long int).
>>> ---
>>>  inet/deadline.c     | 4 ++--
>>>  inet/net-internal.h | 5 +++--
>>>  2 files changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/inet/deadline.c b/inet/deadline.c
>>> index ebf9a4f52c..eac7afd1a8 100644
>>> --- a/inet/deadline.c
>>> +++ b/inet/deadline.c
>>> @@ -28,8 +28,8 @@ struct deadline_current_time
>>>  __deadline_current_time (void)
>>>  {
>>>    struct deadline_current_time result;
>>> -  if (__clock_gettime (CLOCK_MONOTONIC, &result.current) != 0)
>>> -    __clock_gettime (CLOCK_REALTIME, &result.current);
>>> +  if (__clock_gettime64 (CLOCK_MONOTONIC, &result.current) != 0)
>>> +    __clock_gettime64 (CLOCK_REALTIME, &result.current);
>>>    assert (result.current.tv_sec >= 0);
>>>    return result;
>>>  }
>>> diff --git a/inet/net-internal.h b/inet/net-internal.h
>>> index 3ca301a9be..50c7e1c482 100644
>>> --- a/inet/net-internal.h
>>> +++ b/inet/net-internal.h
>>> @@ -24,6 +24,7 @@
>>>  #include <stdint.h>
>>>  #include <sys/time.h>
>>>  #include <libc-diag.h>
>>> +#include <struct___timespec64.h>  
>>
>> Why time.h is not providing the __timespec64 in this case?
> 
> There is quite long queue for Y2038 patches - as in [1].
> 
> The struct __timespec64 has gained its own include file - namely
> ./include/struct___timespec.h [2] - when I do prepared conversion of
> mq_timed{send|receive}
> 
> 
> Links:
> 
> [1] - https://github.com/lmajewski/y2038_glibc/commits/y2038_edge
> [2] -
> https://github.com/lmajewski/y2038_glibc/commit/6c7250ef4bf7ea87479489a825f05bb0de8d7684

Yes, I am aware. I still think that include <time.h> would be better
here. The struct*.h installed files are meant to be used on installed
headers to avoid naming pollution, I don't see a good way to used them
directly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20200324/e65ee101/attachment.sig>


More information about the Libc-alpha mailing list