Re: [Y2038] Question regarding support of old time interfaces beyond y2038
From: Ben Hutchings
Date: Tue Mar 05 2019 - 11:56:37 EST
On Tue, 2019-03-05 at 11:05 -0500, Zack Weinberg wrote:
> > On Tue, Mar 5, 2019 at 10:24 AM Lukasz Majewski <lukma@xxxxxxx> wrote:
> > 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."
>
> 1) We should be clear that most of these will continue to be supported
> as C library interfaces even if they are not system calls.ÂÂSome of
> them are obsolete enough and/or rarely used enough that we might not
> bother (the older ways to set the system clock, for instance).
>
> 2) I know of one case where the new interfaces don't cover all of the
> functionality of the old ones: timers started by setitimer continue to
> run after an execve, timers started by timer_create don't.ÂÂThis means
> setitimer(ITIMER_VIRTUAL) can be used to impose a CPU time limit on a
> program you didn't write, and timer_create can't.ÂÂIf new kernels are
> not going to have setitimer as a primitive, we need some other way of
> getting the same effect.
{get,set}itimer() are still implemented on all architectures, and I
don't see any sign that that's going to change. There aren't 64-bit
versions on 32-bit architectures though. This is explained in the
message for commit 48166e6ea47d23984f0b481ca199250e1ce0730a:
"...these can all be safely implemented in the C library by wrapping
around the existing system calls because the 32-bit time_t they pass
only counts elapsed time, not time since the epoch."
Ben.
--
Ben Hutchings, Software Developer  Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom