[RFC v4 06/24] sysdeps/timespec_get: Use clock_gettime64 if avaliable

Joseph Myers joseph@codesourcery.com
Thu Aug 15 20:59:00 GMT 2019


On Thu, 15 Aug 2019, Alistair Francis wrote:

> Ok, so more like this?
> 
> #if __TIMESIZE == 64
> # define timespec_get __timespec_get64
> #else
> # define timespec_get __timespec_get32
> #endif

No.  Please see what's done for mktime, for example (but it's simpler here 
because mktime supports being built outside of glibc, which is irrelevant 
for timespec_get).

* The function __mktime64 is defined, unconditionally.

* The function mktime is defined as a thin wrapper, conditionally (only 
when 32-bit time is supported).

* There's no __mktime32 anywhere.

* mktime-internal.h deals with defining __mktime64 back to mktime in the 
case where __TIMESIZE == 64 and so only a single function is needed with 
no wrapper.

> > # ifndef __NR_clock_gettime64
> > #  define __NR_clock_gettime64 __NR_clock_gettime
> > # endif
> >
> > here, because 64-bit platforms define __ASSUME_TIME64_SYSCALLS but with
> > unsuffixed syscall names.
> 
> The kernel defines 64 suffixed syscalls, is this required because
> older kernels don't do this?

The kernel does *not* define 64-suffixed syscalls on platforms where 
__SYSCALL_WORDSIZE == 64.  It defined unsuffixed syscalls with the same 
semantics.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list