lkml.org 
[lkml]   [2019]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [Y2038] Question regarding support of old time interfaces beyond y2038
On Tue, Mar 5, 2019 at 4:24 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> Dear Arnd,
>
> In your "playground" repository [1] (branch: y2038), the time functions
> (stime, settimeofday, etc) are not converted in Linux to be Y2038 aware
> (as for example clock_settime{64}() is).

Correct. FWIW, this is now merged into the mainline kernel.

> I've also searched on the Internet and I've found some old discussions
> regarding them:
>
> SHA1: d33c577cccd0b3e5bb2425f85037f26714a59363 [2]
> From commit message:
>
> "The time, stime, utime, utimes, and futimesat system calls are only
> used on older architectures, and we do not provide y2038 safe variants
> of them, as they are replaced by clock_gettime64, clock_settime64,
> and utimensat_time64."
>
> Moreover, the stime has been even explicitly marked as obsolete [3].
>
>
> From other discussion [4] - regarding the following system calls:
> time, stime, gettimeofday, settimeofday, adjtimex, nanosleep, alarm,
> getitimer, setitimer, select, utime, utimes, futimesat, and
> {old,new}{l,f,}stat{,64}.
>
> "These all pass 32-bit time_t arguments on 32-bit
> architectures and are replaced by other interfaces (e.g. posix
> timers and clocks, statx). C libraries implementing 64-bit time_t in
> 32-bit architectures have to implement the handles by wrapping
> around the newer interfaces."
>
>
>
>
> Has something changed since then? Has any new idea for conversion
> emerged?

No, this has been the plan for many years now.

> After observing the development of y2038 on playground [1], I can deduce
> that new interfaces are only going to be supported and converted
> (clock_settime64/clock_gettime64, etc.)
>
> Considering the above - would it be best to drop Y2038 support on 32
> bit machines for old syscalls (stime and friends) and for some others
> (settimeofday/gettimeofday) write Y2038 wrappers based on new time
> kernel API (clock_gettime/settime) in the C library (i.e. glibc)?

There are multiple dimensions to what you are asking here:

- On the user space interface, the C library (glibc, musl, uclibc, ...)
implements a set of interfaces for time management. The
set that is implemented here is defined by POSIX and other
standards and decided by the respective C library implementation.
All functions that get implemented here have to use the same
definition of time_t however, so if there is both a clock_gettime()
function and a time() function, they must either both use 32-bit
time_t or both must use 64-bit time_t. Both can be implemented
on top of any kernel interface for getting the time (time, gettimeofday,
clock_gettime, clock_gettime64), but the only sensible implementation
is to use clock_gettime64() in order to have the full range and
resolution.

- The kernel has a growing set of system calls, i.e. we tend to
only add new ones but not take old ones away. In many cases,
a new syscall is a superset of the old one (e.g. oldstat, newstat
stat64, xstat), any architecture that had an old version has
to keep it around, but new architectures only ever provide the
most recent variant.

Arnd

\
 
 \ /
  Last update: 2019-03-05 18:05    [W:0.135 / U:1.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site