This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC PATCH] AARCH64/ILP32: introduce kernel time types
- From: Arnd Bergmann <arnd at arndb dot de>
- To: Yury Norov <ynorov at caviumnetworks dot com>
- Cc: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org, vapier at gentoo dot org, joseph at codesourcery dot com, cmetcalf at tilera dot com, pinskia at gmail dot com, cmetcalf at mellanox dot com, szabolcs dot nagy at arm dot com, bamvor dot zhangjian at huawei dot com, schwab at suse dot de, catalin dot marinas at arm dot com, Prasun dot Kapoor at cavium dot com, maxim dot kuvyrkov at linaro dot org
- Date: Tue, 28 Jun 2016 11:16:17 +0200
- Subject: Re: [RFC PATCH] AARCH64/ILP32: introduce kernel time types
- Authentication-results: sourceware.org; auth=none
- References: <1467103498-24243-1-git-send-email-ynorov at caviumnetworks dot com> <d46c4d99-3269-b3d5-8183-b09c3b3d7073 at redhat dot com> <20160628085649 dot GA24025 at yury-N73SV>
On Tuesday, June 28, 2016 11:56:49 AM CEST Yury Norov wrote:
> On Tue, Jun 28, 2016 at 10:51:49AM +0200, Florian Weimer wrote:
> > On 06/28/2016 10:44 AM, Yury Norov wrote:
> > >Structures utmp and utmpx are shared between ilp32 and native ABIs,
> > >and so should have same layout. As now, architectures where this
> > >compatibility is required enable __WORDSIZE_TIME64_COMPAT32 option,
> > >and so make lp64 utmp{x} backward-compatible to ilp32 ones.
> > >
> > >AARCH64 doesn't require such compatibility, and so we can do opposite
> > >conversion.
> >
> > Thanks, I agree this is the right way forward.
> >
> > >This patch introduces new option __KERNEL_TIME_T_MATCHES_TIME64_T,
> >
> > >+struct __kernel_timeval
> > >+ {
> > >+ __ktime_t tv_sec; /* Seconds. */
> > >+ __ksuseconds_t tv_usec; /* Microseconds. */
> > >+ };
> >
> > We rarely use the __KERNEL_ and __kernel_ prefixes, but the kernel uapi
> > includes do. I would suggest to use a different prefix.
>
> __kernel_time_t is already imported from linux headers. It is defined
> wrong, at least for arm64, and is not used. I don't want to touch it,
> as I am not sure other C libraries don't use it.
__kernel_time_t is what gets used in the kernel header files and
is always defined as 'long' (except on x86/x32), and it is the type
used for all syscall interfaces.
We have to separate three things here:
- the type for time_t that is used between glibc and applications
- the type for __kernel_time_t that is used between the kernel and glibc
- the type used for utmp/utmpx
My first reply was about the first two, which we cannot really change
freely. What you want here is the third, but that should be entirely
separate from anything that has the word 'kernel' in it.
It's worth noting that apparently the arm64 glibc port has diverged
from the practice of the other 64-bit ports that have an alternative
32-bit architecture, and the utmp/utmpx formats are incompatible
between 32-bit ARM and the existing ARM64. This seems unfixable
at this point, until we have come up with a solution that works
around the y2038 overflow of utmpx on arm32.
We probably want something local to the sysdeps/gnu/bits/utmp{,x}.h
files that makes the timestamps 64-bit for all new architectures,
but defining a 'struct __kernel_timeval' here would not be helpful.
Arnd