public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Lukasz Majewski <lukma@denx.de>
Cc: Joseph Myers <joseph@codesourcery.com>,
	Alistair Francis <alistair23@gmail.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Andreas Schwab <schwab@suse.de>
Subject: Re: [PATCH v2 5/5] y2038: Replace __clock_gettime with __clock_gettime64
Date: Mon, 4 May 2020 13:37:36 -0300	[thread overview]
Message-ID: <2f51c6b9-c371-cc30-8bc1-0caab5f71a82@linaro.org> (raw)
In-Reply-To: <20200504173226.6f64396d@jawa>


[-- Attachment #1.1: Type: text/plain, Size: 4802 bytes --]



On 04/05/2020 12:32, Lukasz Majewski wrote:
> Hi Adhemerval,
> 
>> On 01/05/2020 08:56, Lukasz Majewski wrote:
>>> Hi Adhemerval,
>>>   
>>>> On 26/03/2020 05:06, Lukasz Majewski wrote:  
>>>>> diff --git a/nis/nis_call.c b/nis/nis_call.c
>>>>> index 92c70e97aa..9c6f62a753 100644
>>>>> --- a/nis/nis_call.c
>>>>> +++ b/nis/nis_call.c
>>>>> @@ -709,7 +709,7 @@ __nisfind_server (const_nis_name name, int
>>>>> search_parent, nis_error status;
>>>>>    directory_obj *obj;
>>>>>    struct timeval now;
>>>>> -  struct timespec ts;
>>>>> +  struct __timespec64 ts;
>>>>>    unsigned int server_used = ~0;
>>>>>    unsigned int current_ep = ~0;
>>>>>  
>>>>> @@ -719,8 +719,8 @@ __nisfind_server (const_nis_name name, int
>>>>> search_parent, if (*dir != NULL)
>>>>>      return NIS_SUCCESS;
>>>>>  
>>>>> -  __clock_gettime (CLOCK_REALTIME, &ts);
>>>>> -  TIMESPEC_TO_TIMEVAL (&now, &ts);
>>>>> +  __clock_gettime64 (CLOCK_REALTIME, &ts);
>>>>> +  now = valid_timespec64_to_timeval (ts);
>>>>>  
>>>>>    if ((flags & NO_CACHE) == 0)
>>>>>      *dir = nis_server_cache_search (name, search_parent,
>>>>> &server_used,    
>>>>
>>>> I think it would be simpler to just remove the timeval argument on
>>>> nis_server_cache_search and move the __clock_gettime64 call on the
>>>> function start.   
>>>
>>> Have I understood you correctly that you recommend removing the
>>> "now" struct timeval argument and then call explicitly
>>> __clock_gettime64 on the beginning of nis_server_cache_search
>>> function?  
>>
>> Yes, the nis_server_cache_search is a static function used only once
>> at __nisfind_server.
> 
> Ok.
> 
>>
>>>   
>>>>
>>>> Also, it would require to change nis_server_cache to use a
>>>> __time64_t for 'expires', otherwise this change won't help in
>>>> case of a time_t overflow.
>>>>  
>>>
>>> Ok. I will update this. Thanks for pointing this out.
>>>   
>>>>  
>>>>> diff --git a/sysdeps/generic/hp-timing.h
>>>>> b/sysdeps/generic/hp-timing.h index e2d7447212..af9d92f7f7 100644
>>>>> --- a/sysdeps/generic/hp-timing.h
>>>>> +++ b/sysdeps/generic/hp-timing.h
>>>>> @@ -34,8 +34,8 @@ typedef uint64_t hp_timing_t;
>>>>>     vDSO symbol.  */
>>>>>  #define HP_TIMING_NOW(var) \
>>>>>  ({
>>>>> 	\
>>>>> -  struct timespec tv;
>>>>> 	\
>>>>> -  __clock_gettime (CLOCK_MONOTONIC, &tv);
>>>>> \
>>>>> +  struct __timespec64 tv;
>>>>> 	\
>>>>> +  __clock_gettime64 (CLOCK_MONOTONIC, &tv);
>>>>> \ (var) = (tv.tv_nsec + UINT64_C(1000000000) * tv.tv_sec);
>>>>> \ })
>>>>>      
>>>>
>>>> Ok.
>>>>  
>>>>> diff --git a/sysdeps/generic/memusage.h
>>>>> b/sysdeps/generic/memusage.h index a111864b0b..91e56d24de 100644
>>>>> --- a/sysdeps/generic/memusage.h
>>>>> +++ b/sysdeps/generic/memusage.h
>>>>> @@ -28,9 +28,9 @@
>>>>>  #ifndef GETTIME
>>>>>  # define GETTIME(low,high)
>>>>> 	   \ {
>>>>> 			   \
>>>>> -    struct timespec now;
>>>>> 	   \
>>>>> +    struct __timespec64 now;
>>>>> 		   \ uint64_t usecs;
>>>>> 			   \
>>>>> -    clock_gettime (CLOCK_REALTIME, &now);
>>>>> 	   \
>>>>> +    __clock_gettime64 (CLOCK_REALTIME, &now);
>>>>> 		   \ usecs = (uint64_t)now.tv_nsec / 1000 +
>>>>> (uint64_t)now.tv_sec * 1000000; \ low = usecs & 0xffffffff;
>>>>> 					   \ high = usecs >>
>>>>> 32;							   \
>>>>>  
>>>>
>>>> Is is the requirement to export __clock_gettime64 as a
>>>> GLIBC_PRIVATE symbol?
>>>>  
>>>
>>> The __clock_gettime is already exported as GLIBC_PRIVATE at
>>> ./time/Versions, so I'm following this pattern.
>>>
>>> Moreover, the glibc will not build when __clock_gettime64 is not
>>> exported.
>>>   
>>>> In any case, I think we should try to avoid use internal symbols
>>>> even for distributed glibc libraries, so I think this change
>>>> should go once we start to export the clock_gettime64 as default
>>>> symbol.  
>>>
>>> Am I correct that this is a preprocessor macro, which is in the
>>> exported header?  
>>
>> In fact __clock_gettime is used on other internal libraries and it
>> is required as is to avoid linknamespace pollution.  So it seems
>> that __clock_gettime64 should follow the same logic.
> 
> Ok, So then __clock_gettime64 shall be exported as well.
> 
>>
>> It might be misleading that for some ABI __clock_gettime and
>> for other __clock_gettime64 will be used internally, but it should
>> be ok nonetheless.
>>
> 
> All the occurrences of __clock_gettime shall be replaced by
> __clock_gettime64 internally in glibc as __clock_gettime64 is Y2038
> safe for e.g. ARM32 and is aliased to __clock_gettime for 64 bit archs
> anyway.

I meant that some architectures does not provide __clock_gettime64 and
thus the internal symbol will be __clock_gettime. But it is not an
issue in fact.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-05-04 16:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  8:06 [PATCH v2 0/5] " Lukasz Majewski
2020-03-26  8:06 ` [PATCH v2 1/5] y2038: Export __clock_gettime64 to be usable in other libraries Lukasz Majewski
2020-03-26  8:06 ` [PATCH v2 2/5] y2038: hurd: Provide __clock_gettime64 function Lukasz Majewski
2020-03-26  8:06 ` [PATCH v2 3/5] y2038: inet: Convert inet deadline to support 64 bit time Lukasz Majewski
2020-04-30 20:51   ` Adhemerval Zanella
2020-03-26  8:06 ` [PATCH v2 4/5] y2038: nscd: Modify nscd_helper to use __clock_gettime64 Lukasz Majewski
2020-04-30 20:54   ` Adhemerval Zanella
2020-05-01 11:30     ` Lukasz Majewski
2020-05-04 12:27       ` Adhemerval Zanella
2020-05-04 15:26         ` Lukasz Majewski
2020-05-04 16:36           ` Adhemerval Zanella
2020-03-26  8:06 ` [PATCH v2 5/5] y2038: Replace __clock_gettime with __clock_gettime64 Lukasz Majewski
2020-04-06 16:07   ` Florian Weimer
2020-04-06 21:03     ` Lukasz Majewski
2020-04-14 12:14       ` Lukasz Majewski
2020-04-21 13:48         ` Lukasz Majewski
2020-04-29 21:48           ` Lukasz Majewski
2020-04-30 21:03   ` Adhemerval Zanella
2020-05-01 11:56     ` Lukasz Majewski
2020-05-04 14:04       ` Adhemerval Zanella
2020-05-04 15:32         ` Lukasz Majewski
2020-05-04 16:37           ` Adhemerval Zanella [this message]
2020-05-05 18:31         ` Lukasz Majewski
2020-04-06 15:16 ` [PATCH v2 0/5] " Lukasz Majewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f51c6b9-c371-cc30-8bc1-0caab5f71a82@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.de \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).