struct timex and Linux adjtimex()
Poul-Henning Kamp
phk at phk.freebsd.dk
Thu Dec 3 07:59:05 UTC 2020
--------
Cy Schubert writes:
> 1. A new syscall, similar to clock_settime() and clock_gettime() that
> adds/subtracts the delta, in a struct timespec, via a call to
> kern_clock_settime(). Then atomically returns the current time as if
> clock_gettime() was immediately called.
Did they say why they need this and why simply setting the clock is not
good enough ?
What program uses this ?
> Option 2, implement the Linux adjtimex():
>
> 1. The Linux adjtimex() appears to be a re-implementation of ntp_adjtime()
> with the addition of ADJ_SETOFFSET.
ntp_adjtime(2), modulus argument transformations, does what linux adjtimex(2) does.
adjtimex() is actually Dave Mills temporarry name, pending Suns integration
into their kernel. Sun messed up and used that name, instead of the name
he had proposed.
I renamed it in FreeBSD many years ago to his preferred name.
> 2. ADJ_SETOFFSET adds or subtracts the time specified in a struct timeval
> within the timex struct. Unfortunately the FreeBSD timex struct contains no
> timeval. To implement this would require versioned symbols to maintain
> backward compatiblity.
If we do this, it should respect the MOD_NANO protocol ot use either
timeval or timespec.
> 1. Are we, FreeBSD, interested in implementing the Linux adjtimex()
> syscall? (I would take on the task to author it should we feel this is a
> worthwhile project. OTOH I prefer not to spend the time working on this if
> the community feels otherwise.)
Unless given very compelling reasons: No.
Adding ADJ_SETOFFSET to ntp_adjtime(2): possibly.
> 2. From a cursory scan through the tree it appears that ntp is the only
> internal consumer of struct timex. There are probably others in ports and
> other third party software such as openntpd and chrony. A versioned symbol
> should satisfy old applications which might use the previous timex struct.
ntp_adjtime()/adjtimex() is the only way to wrangle the clock gently, and
there are site-specific software which uses it for that, it is a published
and used API/ABI.
> Are we interested in the Linux adjtimex(2) for FreeBSD?
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-arch
mailing list