This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC v4 05/24] sysdeps/clock_gettime: Use clock_gettime64 if avaliable
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Alistair Francis <alistair23 at gmail dot com>
- Cc: Alistair Francis <alistair dot francis at wdc dot com>, GNU C Library <libc-alpha at sourceware dot org>, Arnd Bergmann <arnd at arndb dot de>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Florian Weimer <fweimer at redhat dot com>, Palmer Dabbelt <palmer at sifive dot com>, <macro at wdc dot com>, Zong Li <zongbox at gmail dot com>
- Date: Wed, 14 Aug 2019 16:37:41 +0000
- Subject: Re: [RFC v4 05/24] sysdeps/clock_gettime: Use clock_gettime64 if avaliable
- Ironport-sdr: nyTYfYqI9uqvYJ66PQvu6IKAvR6zN5LwzW5zD3oQbdOFKReWf/IIfUL9uQXFHetg5E/KP6WNIH PL8wEC9iII6JZsZC6vqhulu/muMVwMy+Da1HSB5JCjekWq+b+nI4qxPoKDxPH/Y3FSNNY0nMU2 p+3FJN2nppgm+OjP7UN0NcQW39k1PbLAJcyypHgI5Ezjay3chuFGdJq4aycZXWtqsw2EAqWuCo xb7MULdWvRSrc4Ft0Tzeil0dnlxJ/kLv/PhX3cnpigmCCm3cUnYwlRgej3XJMmsk8bgF4KzdSm FUs=
- Ironport-sdr: DFL/UIS5MN5ZFPtviBNpLd++Rrp6o/a+4usNu2mq6Z8OsIlXWFP4oP6GRxwX++uZQu5lcQaVdV C/FaL6hBl5HCzhGOoYBzLdUtuhoA1xdCC5dZs7MBbboRPl8orjAFVDcfnvISaHBGJNQw+1QhNp O9pmGbj1yVrg7wsaEE/+TTHFrR8lX0aWPKMvPIcdZAWVUGsChnMcby+TVXOfyKuo5A2Aaw91ft 3QgRg9FuqbMySjjsLRfz9zoziqH37PO5ZIHTSv4thwzeDdq8xBhf/OHLJIjPoeGRaeo4HI+U83 O1I=
- References: <cover.1565398513.git.alistair.francis@wdc.com> <84b269f1c4a8633e01bd623c07080143c70b785e.1565398513.git.alistair.francis@wdc.com> <alpine.DEB.2.21.1908121945510.18203@digraph.polyomino.org.uk> <CAKmqyKPWRDrudcYc6SHizH1EDfGgL6QQvrn7PtrAM1ohCFStSQ@mail.gmail.com>
On Tue, 13 Aug 2019, Alistair Francis wrote:
> I was under the impression (although possibly incorrectly) that if
> __ASSUME_TIME64_SYSCALLS is defined we would have a 64-bit time_t. Is
> __ASSUME_TIME64_SYSCALLS going to be defined on 32-bit architectures
> that are still using a 32-bit time_t?
Yes. --enable-kernel=5.1.0 is not an ABI-changing option; it only affects
what syscalls glibc can assume to be present at runtime in the kernel it
runs on.
__ASSUME_TIME64_SYSCALLS means only that certain syscalls using 64-bit
time are assumed to be available: either suffixed versions such as
__NR_clock_gettime64, or corresponding unsuffixed versions such as
__NR_clock_gettime in the case where those use 64-bit time and have
exactly the same semantics and so "#define __NR_clock_gettime64
__NR_clock_gettime" is OK. (Because the kernel headers must be at least
as recent as the minimum kernel version used at runtime, it also implies
that the kernel headers do define the syscall numbers - but as noted, the
syscalls might be __NR_clock_gettime etc. rather than the suffixed
versions.)
All four combinations of __ASSUME_TIME64_SYSCALLS and __TIMESIZE are
valid.
1. __TIMESIZE == 64 and __ASSUME_TIME64_SYSCALLS defined means a glibc
port does not support anything other than 64-bit time *as its userspace
ABI*, with the minimum kernel version ensuring appropriate syscalls are
available. Cases of this include:
(a) Classic 64-bit systems (__WORDSIZE == 64, unsuffixed syscalls).
(b) x32 (__WORDSIZE == 32, __SYSCALL_WORDSIZE == 64, unsuffixed syscalls).
(c) New glibc ports with 32-bit "long int" in the syscall interface
(__WORDSIZE == 32 and __SYSCALL_WORDSIZE == 32) but only supporting 64-bit
time as its userspace ABI and with the configured minimum kernel version
(5.1 or later) ensuring appropriate (suffixed) syscalls are available (and
unsuffixed ones don't exist at all). This is the case that applies to
RV32.
2. __TIMESIZE == 64 and __ASSUME_TIME64_SYSCALLS not defined means a glibc
port that does not support anything other than 64-bit time *as its
userspace ABI*, but with the minimum kernel version not ensuring
appropriate syscalls are available. This implies __WORDSIZE == 32 and
__SYSCALL_WORDSIZE == 32. This is a hypothetical case, if a new glibc
port were added for a 32-bit architecture that was supported in the Linux
kernel before 5.1, and if it were chosen to have 64-bit time as the
userspace ABI for this port but to support using kernels before 5.1. As
it's hypothetical, it's not something you're expected to test unless
adding such a port - but most of the support for it should naturally fall
out from the Y2038 implementation anyway (the support for 64-bit
interfaces to use 32-bit syscalls when run on older kernels).
3. __TIMESIZE == 32 and __ASSUME_TIME64_SYSCALLS defined means a 32-bit
glibc port, where the unsuffixed time-related ABIs in glibc use 32-bit
time but the Y2038 work will add corresponding suffixed ABIs (and
_TIME_BITS headers support) that use 64-bit time - and where the minimum
kernel version ensures 64-bit-time (suffixed) syscalls are available. So
the suffixed ABIs for 64-bit time can call those suffixed syscalls
unconditionally, but the unsuffixed ABIs need to do appropriate
translation between 32-bit and 64-bit time to call those syscalls (and the
expected design is that the unsuffixed ABIs will generally be thin
wrappers that do such translation and call the suffixed ones).
4. __TIMESIZE == 32 and __ASSUME_TIME64_SYSCALLS not defined means a
32-bit glibc port, where the unsuffixed time-related ABIs in glibc use
32-bit time but the Y2038 work will add corresponding suffixed ABIs (and
_TIME_BITS headers support) that use 64-bit time - and where the minimum
kernel version does not ensure that 64-bit-time (suffixed) syscalls are
available. Thus, the suffixed ABIs for 64-bit time need to have support
for falling back to the 32-bit syscalls when the 64-bit ones are not
available.
--
Joseph S. Myers
joseph@codesourcery.com