Date: Thu, 03 Dec 2020 07:58:55 +0000 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Cy Schubert <Cy.Schubert@cschubert.com> Cc: freebsd-arch@freebsd.org Subject: Re: struct timex and Linux adjtimex() Message-ID: <4086.1606982335@critter.freebsd.dk> In-Reply-To: <202012030523.0B35NsG7003810@slippy.cwsent.com> References: <202012030523.0B35NsG7003810@slippy.cwsent.com>
next in thread | previous in thread | raw e-mail | index | archive | help
-------- 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 integratio= n 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 timeva= l = > 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 an= d = > other third party software such as openntpd and chrony. A versioned symb= ol = > should satisfy old applications which might use the previous timex struc= t. 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@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= .
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4086.1606982335>