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 v4] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable



On 06/11/2019 07:11, Lukasz Majewski wrote:
>> diff --git a/nptl/thrd_sleep.c b/nptl/thrd_sleep.c
>> index 2e185dd748e..c865f815eea 100644
>> --- a/nptl/thrd_sleep.c
>> +++ b/nptl/thrd_sleep.c
>> @@ -17,23 +17,18 @@
>>     <https://www.gnu.org/licenses/>.  */
>>  
>>  #include <time.h>
>> -#include <sysdep-cancel.h>
>> -
>> -#include "thrd_priv.h"
>> +#include <errno.h>
>>  
>>  int
>>  thrd_sleep (const struct timespec* time_point, struct timespec*
>> remaining) {
>> -  INTERNAL_SYSCALL_DECL (err);
>> -  int ret = INTERNAL_SYSCALL_CANCEL (nanosleep, err, time_point,
>> remaining);
>> -  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
>> -    {
>> -      /* C11 states thrd_sleep function returns -1 if it has been
>> interrupted
>> -	 by a signal, or a negative value if it fails.  */
>> -      ret = INTERNAL_SYSCALL_ERRNO (ret, err);
>> -      if (ret == EINTR)
>> -	return -1;
>> -      return -2;
>> -    }
>> -  return 0;
>> +  int ret = __clock_nanosleep (CLOCK_REALTIME, 0, time_point,
>> remaining);
> 
> Maybe this is a bit off topic (generic question to 64 bit time support)
> - but I'm wondering if we shall not use __clock_nanosleep_time64 here
> just from the outset? 
> 
> With using __clock_nanosleep() as the internal function, the
> architectures with __TIMESIZE != 64 (e.g. ARM32 bit) will not benefit
> from having internal glibc support for 64 bit time representation (as
> their __clock_nanosleep version uses 32 bit to represent time).
> 
> Of course we can stick to __clock_nanosleep, but then those functions
> would need to be aliased or (better) renamed in the code before Y2038.
> 
> The same situation is with e.g. internal usage of __clock_settime.
> 
The C11 thrd_sleep would require a time64 support using the same
strategy as the other symbols, i.e, adding a thrd_sleep_time64 for
time64 enabled architectures and refactor thrd_sleep in terms of
thrd_sleep_time64.

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]