From owner-freebsd-arch@freebsd.org Thu Dec 3 05:24:00 2020 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A73947A8CD for ; Thu, 3 Dec 2020 05:24:00 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmklg1Ypsz4ns0 for ; Thu, 3 Dec 2020 05:23:58 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id kh5wkWa45tdldkh5xkgf84; Wed, 02 Dec 2020 22:23:57 -0700 X-Authority-Analysis: v=2.4 cv=INe8tijG c=1 sm=1 tr=0 ts=5fc8766d a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=zTNgK-yGK50A:10 a=YxBL1-UpAAAA:8 a=6I5d2MoRAAAA:8 a=EkcXrb_YAAAA:8 a=neO_dujWEq-zw7rLH8MA:9 a=CjuIK1q_8ugA:10 a=Ia-lj3WSrqcvXOmTRaiG:22 a=IjZwj45LgO3ly-622nXo:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 10EF8580 for ; Wed, 2 Dec 2020 21:23:55 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 0B35NsG7003810 for ; Wed, 2 Dec 2020 21:23:54 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202012030523.0B35NsG7003810@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: freebsd-arch@freebsd.org Subject: struct timex and Linux adjtimex() Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Dec 2020 21:23:54 -0800 X-CMAE-Envelope: MS4xfAen6ZgCc73rd7Wabak7R6A1Kl/1KwkQ5bJXkMjKFBnedcFvAr4zhPcgqI0rXuXoFwvtvF3Su7J29QKsyauRTmZpTsUr8dYndANQttEsqYjoU3zkp3H0 HdofT3fmaoZ//7P4GS2DuME7e4gVqxy877e0Va6qGo65GNzCkKjPWq1Weo/wcOcNvy4b9IhLqt1f1qXps+bCWz4RMP+cXCyV4fw= X-Rspamd-Queue-Id: 4Cmklg1Ypsz4ns0 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.9) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [0.30 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.134.9:from]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.134.9:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-arch@freebsd.org]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[64.59.134.9:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.134.9:from]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[freebsd-arch] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 05:24:00 -0000 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 FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few.