From owner-freebsd-arch@freebsd.org Thu Dec 3 07:59:05 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 44CBB47DBB5 for ; Thu, 3 Dec 2020 07:59:05 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmpBb6jv7z3Cfg for ; Thu, 3 Dec 2020 07:59:03 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id E9C538A577; Thu, 3 Dec 2020 07:58:55 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.16.1/8.16.1) with ESMTPS id 0B37wtSE004088 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 3 Dec 2020 07:58:55 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.16.1/8.16.1/Submit) id 0B37wte7004087; Thu, 3 Dec 2020 07:58:55 GMT (envelope-from phk) To: Cy Schubert cc: freebsd-arch@freebsd.org Subject: Re: struct timex and Linux adjtimex() In-reply-to: <202012030523.0B35NsG7003810@slippy.cwsent.com> From: "Poul-Henning Kamp" References: <202012030523.0B35NsG7003810@slippy.cwsent.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4085.1606982335.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2020 07:58:55 +0000 Message-ID: <4086.1606982335@critter.freebsd.dk> X-Rspamd-Queue-Id: 4CmpBb6jv7z3Cfg X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of phk@critter.freebsd.dk designates 130.225.244.222 as permitted sender) smtp.mailfrom=phk@critter.freebsd.dk X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[130.225.244.222:from]; FREEFALL_USER(0.00)[phk]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.dk]; ARC_NA(0.00)[]; SPAMHAUS_ZRD(0.00)[130.225.244.222:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU]; FROM_NEQ_ENVFROM(0.00)[phk@phk.freebsd.dk,phk@critter.freebsd.dk]; 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 07:59:05 -0000 -------- 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= .