Subject: Re: xntpd
To: None <francus@yossi.com>
From: Greg Earle <earle@isolar.tujunga.ca.us>
List: port-pmax
Date: 01/02/1996 02:46:02
> Yoseff Francus <francus@yossi.com> writes:
> 
>> Has anyone ported xntp to NetBSD??
> 
> You might be better off asking current-users, which is where I'm
> cc:ing this.

It's already been ported, long ago.  Craig Leres did a 4.4BSD port, and now
there's a "machines/netbsd" hints file in xntpd 3.4y.  I'm running 3.4v on a
NetBSD/SPARC 1.0 SPARCstation 2 machine and the only thing I changed was
the binary location (/usr/local/bin -> /usr/local/sbin) in the Config setup.

> I'd personally like to see xntp in the NetBSD source tree.  The sparc
> and pmax ports, for instance have lower latency and/or higher
> resolution gettimeofday() code than, say, SunOS or Ultrix; but last
> time I looked, the NetBSD kernel didn't have the adjtime() support
> that ntp used to prefer.

It is there in 1.0.  Not sure what the deal is with 1.1/-current, though.

I also noticed this (in a NetBSD/i386 1.1 kernel):

scipio# uname -r
1.1
scipio# nm /netbsd | egrep adjtime
f82109a8 T _freebsd_ntp_adjtime
f8117c74 T _sys_adjtime

(It said "freebsd" ... heh hehhehheh hehheh heh)

I'm not sure what happens in this case.  The NTP code really wants to implement
ntp_adjtime() as a direct system call:

#ifdef KERNEL_PLL
[...]

#ifndef NTP_SYSCALLS_LIBC
#define ntp_gettime(t)  syscall(SYS_ntp_gettime, (t))
#define ntp_adjtime(t)  syscall(SYS_ntp_adjtime, (t))
#endif /* not NTP_SYSCALLS_LIBC */
#endif /* KERNEL_PLL */

If this call is actually not present, a trap handler is invoked which turns
off a pll_control variable, which is tested in xntpd/ntp_loopfilter.c (and
xntpd/ntp_request.c):

	/*
	 * If the phase-lock loop is not implemented in the kernel, we
	 * do it the hard way using incremental adjustments and the
	 * adjtime() system call.
	 */
	if (pll_control && pll_enable)
		return;

Presumably this isn't a problem with NetBSD 1.0, since adjtime() is in both
the kernel and libc.  Since there's no mention of sys_adjtime() in the xntpd
distribution, I'm not sure what would happen in this case.  Anyone?

(I suppose I should just try to build the damn thing on the 1.1 box and try
 it out, eh?)

> Are there any copyright/license problems with incorporating xntp into
> the NetBSD source tree?

This is the start of the current NTP distribution "COPYRIGHT" file:

/******************************************************************************
 *                                                                            *
 * Copyright (c) David L. Mills 1992, 1993, 1994                              *
 *                                                                            *
 * Permission to use, copy, modify, and distribute this software and its      *
 * documentation for any purpose and without fee is hereby granted, provided  *
 * that the above copyright notice appears in all copies and that both the    *
 * copyright notice and this permission notice appear in supporting           *
 * documentation, and that the name University of Delaware not be used in     *
 * advertising or publicity pertaining to distribution of the software        *
 * without specific, written prior permission.  The University of Delaware    *
 * makes no representations about the suitability this software for any       *
 * purpose.  It is provided "as is" without express or implied warranty.      *
 *                                                                            *
 ******************************************************************************
/

Seems reasonable to me.

	- Greg