This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 2/7] y2038: Introduce __ASSUME_64BIT_TIME define
- From: Stepan Golosunov <stepan at golosunov dot pp dot ru>
- To: Lukasz Majewski <lukma at denx dot de>
- Cc: Joseph Myers <joseph at codesourcery dot com>, libc-alpha at sourceware dot org, Arnd Bergmann <arnd at arndb dot de>, Paul Eggert <eggert at cs dot ucla dot edu>
- Date: Wed, 8 May 2019 23:48:29 +0400
- Subject: Re: [PATCH v2 2/7] y2038: Introduce __ASSUME_64BIT_TIME define
- References: <20190430214748.rzjlcu3f3hdyqnhw@sghpc.golosunov.pp.ru> <20190502105108.541fe118@jawa> <20190502115459.d3qwvhvmzl6c5kmo@sghpc.golosunov.pp.ru> <20190502155549.2f7bf82d@jawa> <20190506153844.77cad546@jawa> <20190506162659.6d7e4a59@jawa> <20190506193617.nd44jtdt4tty5few@sghpc.golosunov.pp.ru> <20190506231444.088274fc@jawa> <20190507200358.l6gtrjucsnm3vx6r@sghpc.golosunov.pp.ru> <20190508095123.424705cd@jawa>
08.05.2019 в 09:51:23 +0200 Lukasz Majewski написал:
> > Usually the point of __ASSUME_* macros is to avoid compiling old
> > compatibility code when it's not needed. That means there should be
> > no fallback to 32-bit clock_settime when __ASSUME_TIME64_SYSCALLS is
> > defined. Even when it's defined on 32-bit arm or x86.
> >
> > And with your current use of __ASSUME_TIME64_SYSCALLS
> > __NR_clock_settime64 won't be used on any existing architecture.
> > Because __ASSUME_TIME64_SYSCALLS won't be defined until Linux 5.0 is
> > no longer supported.
>
> It will be used when the minimal supported kernel reaches 5.1. (now it
> is 3.2.)
>
> For testing I do use --enable-kernel="5.1.0" passed to configure.
But __NR_clock_settime64 should be used even if minimal supported
kernel is 3.2. If it was available in kernel headers and did not
return ENOSYS.
Otherwise glibc released, say, in 2025 still wouldn't be using
__NR_clock_settime64 on 32-bit x86 even when running on the latest
kernel. Because minimal supported kernel version would be something
like 4.19 then.
Minimal supported kernel version, version of kernel headers used when
compiling glibc and version of kernel glibc is running on—are 3
different kernel versions normally.
What changes when minimal supported kernel becomes 5.1 is the fact
that __NR_clock_settime64 can no longer fail with ENOSYS and thus the
need for fallback to 32-bit __NR_clock_settime disappears.
You need to handle the following 4 cases:
1. 32-bit syscall should not be called (and may not even exist):
1.1. __NR_clock_settime is 64 bit.
1.2. __NR_clock_settime64 works in all supported kernels.
2. __NR_clock_settime is 32-bit and __NR_clock_settime64 may be
unavailable.
2.1. __NR_clock_settime64 is available in kernel headers, but may
fail with ENOSYS when called. 32-bit __NR_clock_settime should be
called if __NR_clock_settime64 is failing.
2.2. __NR_clock_settime64 is not present in kernel headers.
32-bit __NR_clock_settime should be called.