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. > >> >> 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. 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.