This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 01/11] Linux/Alpha: don't use timeval32 system calls.



On 25/10/2019 10:04, Lukasz Majewski wrote:
> Hi Adhemerval,
> 
> Thanks for re-sending those patches to ML. Please find some comments
> below.
> 
[...]
>> +/* Conversion functions.  If the seconds field of a timeval32 would
>> +   overflow, they write { INT32_MAX, TV_USEC_MAX } to the output.  */
>> +
>> +static inline void
>> +tv32_to_tv64 (struct timeval *restrict tv64,
>> +              const struct timeval32 *restrict tv32)
>> +{
>> +  tv64->tv_sec = tv32->tv_sec;
>> +  tv64->tv_usec = tv32->tv_usec;
>> +}
>> +
>> +static inline void
>> +tv32_to_ts64 (struct timespec *restrict ts64,
>> +              const struct timeval32 *restrict tv32)
>> +{
>> +  ts64->tv_sec = tv32->tv_sec;
>> +  ts64->tv_nsec = tv32->tv_usec * 1000;
>> +}
> 
> The ./include/time.h already provides such helper conversion function -
> valid_timeval_to_timespec64 ();
> 
> There are also defined:
> valid_timespec_to_timespec64 ();
> valid_timespec64_to_timespec ();
> valid_timespec64_to_timeval ();
> 
> There is also a different approach (as suggested some time ago by Paul)
> - those helper functions now return the converted structure and accept
>   value (not pointer) to convert.

They are not really the same since they use different types.  The timeval32
for alpha is not exported anymore, it just support the time64 types.  Alpha
is really an outlier and I don't think it really fits on the time64 
refactoring you are doing for 32-bit archs.  So I think we should really
add this arch-specific transformation function.

I changed the required routines to mimic the valid_* one on include/time.h.

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]