Date: Wed, 02 Dec 2020 21:23:54 -0800 From: Cy Schubert <Cy.Schubert@cschubert.com> To: freebsd-arch@freebsd.org Subject: struct timex and Linux adjtimex() Message-ID: <202012030523.0B35NsG7003810@slippy.cwsent.com>
next in thread | raw e-mail | index | archive | help
An NTP developer at approached me about the prospect of a system call to add or subtract time from the system clock, returning the current time after the update. The two options were: 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. 2. His colleague didn't think this was appropriate for their needs. He wants a FreeBSD implementation of the Linux adjtimex() syscall. Though non-standard option 1 is least intrusive on existing applications. 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. 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. Up for discussion is: 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.) 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. Are we interested in the Linux adjtimex(2) for FreeBSD? -- Cheers, Cy Schubert <Cy.Schubert@cschubert.com> FreeBSD UNIX: <cy@FreeBSD.org> Web: https://FreeBSD.org NTP: <cy@nwtime.org> Web: https://nwtime.org The need of the many outweighs the greed of the few.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012030523.0B35NsG7003810>