Subject: xntpd under NetBSD/alpha: bug and fix
To: None <ntp@ni.umd.edu>
From: None <gdt@BBN.COM>
List: port-alpha
Date: 01/09/1996 15:25:35
I compiled xntp3_4y for NetBSD/alpha.
ntpq and ntpdate seemed to work fine.
xntpd complained of ridiculous tick values:
Jan 9 13:27:14 gigabit2 xntpd[26690]: xntpd version=3.4y-gdt (beta multicast, time surveying, tick counter, other); Mon Jan 8 10:16:45 PST 1996 (1)
Jan 9 13:27:14 gigabit2 xntpd[26690]: tick value of 171798692816 is unreasonably large
Note that:
40 * 2^32 + 976 = 171798692816
This is the result of reading two adjacent ints as a long.
I then made the following changes which makes the type for the kernel
variables match the kernel (int which is 4, not long which is 8), and
all seems well:
Jan 9 14:57:14 gigabit2 xntpd[411]: tickadj = 40, tick = 976, tvu_maxslew = 40920
After all this, the machine appears to run 1000 ppm slow.
My questions are:
Has anyone ever run xntp3 on an alpha before?
Did it work?
Is tick a long on OSF/1?
Greg Troxel
<gdt@bbn.com>
Index: ntp_unixclock.c
===================================================================
RCS file: /usr/CVS/ntp/xntpd/ntp_unixclock.c,v
retrieving revision 1.5
diff -u -c -r1.5 ntp_unixclock.c
*** ntp_unixclock.c 1996/01/04 14:41:10 1.5
--- ntp_unixclock.c 1996/01/09 20:03:40
***************
*** 94,100 ****
*/
extern long sys_clock;
! static void clock_parms P((u_long *, u_long *));
/*
* init_systime - initialize the system clock support code, return
--- 94,108 ----
*/
extern long sys_clock;
! #ifdef __alpha__
! typedef unsigned int kernel_tickadj_t;
! typedef unsigned int kernel_tick_t;
! #else
! typedef unsigned long kernel_tickadj_t;
! typedef unsigned long kernel_tick_t;
! #endif
!
! static void clock_parms P((kernel_tickadj_t *, kernel_tick_t *));
/*
* init_systime - initialize the system clock support code, return
***************
*** 118,125 ****
void
init_systime()
{
! u_long tickadj;
! u_long tick;
u_long hz;
/*
--- 126,133 ----
void
init_systime()
{
! kernel_tickadj_t tickadj;
! kernel_tick_t tick;
u_long hz;
/*
***************
*** 243,250 ****
*/
static void
clock_parms(tickadj, tick)
! u_long *tickadj;
! u_long *tick;
{
static struct nlist nl[] = {
#define N_TICKADJ 0
--- 251,258 ----
*/
static void
clock_parms(tickadj, tick)
! kernel_tickadj_t *tickadj;
! kernel_tick_t *tick;
{
static struct nlist nl[] = {
#define N_TICKADJ 0
***************
*** 357,364 ****
static void
clock_parms(tickadj, tick)
! u_long *tickadj;
! u_long *tick;
{
register int i;
int kmem;
--- 365,372 ----
static void
clock_parms(tickadj, tick)
! kernel_tickadj_t *tickadj;
! kernel_tick_t *tick;
{
register int i;
int kmem;
***************
*** 456,463 ****
}
close(kmem);
! *tickadj = (u_long)vars[K_TICKADJ];
! *tick = (u_long)vars[K_TICK];
#undef K_TICKADJ
#undef K_TICK
--- 464,471 ----
}
close(kmem);
! *tickadj = (kernel_tickadj_t)vars[K_TICKADJ];
! *tick = (kernel_tick_t)vars[K_TICK];
#undef K_TICKADJ
#undef K_TICK