This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v5] y2038: Introduce __ASSUME_TIME64_SYSCALLS define
- From: Stepan Golosunov <stepan at golosunov dot pp dot ru>
- To: Lukasz Majewski <lukma at denx dot de>
- Cc: libc-alpha at sourceware dot org, Arnd Bergmann <arnd at arndb dot de>, Paul Eggert <eggert at cs dot ucla dot edu>, Joseph Myers <joseph at codesourcery dot com>
- Date: Thu, 23 May 2019 11:34:48 +0400
- Subject: Re: [PATCH v5] y2038: Introduce __ASSUME_TIME64_SYSCALLS define
- References: <20190414220841.20243-1-lukma@denx.de> <20190515142723.20182-1-lukma@denx.de>
15.05.2019 в 16:27:23 +0200 Lukasz Majewski написал:
> This define indicates if the Linux kernel (5.1+) provides syscalls supporting
> 64 bit versions of struct timespec and timeval.
>
> For architectures with __WORDSIZE==64 and __TIMESIZE==64 (e.g. x86_64, aarch64)
> this flag is never defined (as those already use 64 bit versions of struct
> timespec and timeval).
>
> The __ASSUME_TIME64_SYSCALLS shall be only defined on systems with
> __WORDSIZE==32.
>
> For x32 this flag is explicitly undefined as this architecture has
> __WORDSIZE==32 with __TIMESIZE==64. Despite having __WORDSIZE==32 the x32
> has support for 64 bit time values and hence needs to undefine
> __ASSUME_TIME64_SYSCALLS flag.
What is not clear is how architectures where syscalls like
clock_settime are already using 64-bit time_t are supposed to be
identified. Last patch for clock_settime seems to be using
#if __WORDSIZE != 32 || !defined __NR_clock_settime64 && defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64
to select code for these architectures.
This seems too complicated and potentially buggy. Why not just
define __ASSUME_TIME64_SYSCALLS for this case too and then use
#if defined __ASSUME_TIME64_SYSCALLS && !defined __NR_clock_settime64
?
Especially given that in most cases the only difference in resulting
code with __ASSUME_TIME64_SYSCALLS defined would be the name of the
constant used (__NR_clock_settime64 when it's defined,
__NR_clock_settime otherwise).