xntp patches for SGI IRIS

Scott Henry scotth at corp.sgi.com
Fri Jun 28 01:00:52 AEST 1991


Distribution: 
FCC: |/usr/local/lib/mh/rcvstore +Article


Since a lot of people requested this patch file, I though that I'd post
them in addition to mailing to the requestors. These patches have evolved
over several months of trying to make xntp work well internally to SGI.

I suppose I gotta say some of this legal guf: this software is not
supported or officially sanctioned by SGI. There is no known intent to
support xntp as a product, and if you try to call the hotline for support
your going to get "Huh??" as a reply. If you have problems installing
this, email me and I'll try to help as time permits.

This file consists of context diffs from the xntp ditribution at
louie.udel.edu (as far as I know, it's the latest version there). If you
don't have the patch utility, I'd get it and install it first (there's a
lot of difs with possibility for error if done manually). I believe patch
is available in the comp.sources.unix archive. After you build xntp, look
in the file README-SGI for hints on installing it (also the install/
directory).

diff -cr ../louie/Config ./Config
*** ../louie/Config	Tue Nov 14 10:45:14 1989
--- ./Config	Sun Apr  7 22:29:26 1991
***************
*** 55,61 ****
  # To change the location of the configuration file, use a
  #	-DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar.
  #
! DEFS= # -DNO_SIGNED_CHAR_DECL
  
  #
  # Clock support definitions (these only make sense if -DREFCLOCK used):
--- 55,63 ----
  # To change the location of the configuration file, use a
  #	-DCONFIG_FILE=\\"/local/etc/ntp.conf\\" or something similar.
  #
! # DEFS= # -DNO_SIGNED_CHAR_DECL
! # DEFS= -DREFCLOCK -DDEBUG
! DEFS= -DCONFIG_FILE=\\"/usr/etc/ntp.conf\\" -DKEYFILE=\\"/usr/etc/ntp.keys\\" -DADJTIME_IS_ACCURATE
  
  #
  # Clock support definitions (these only make sense if -DREFCLOCK used):
***************
*** 71,82 ****
  #	previously have installed the CHU serial line discipline in
  #	the kernel of the machine you are doing the compile on.
  #
! CLOCKDEFS=
  
  #
  # For MIPS 4.3BSD or RISCos 4.0, include a -lmld to get the nlist() routine
  #
! DAEMONLIBS= # -lmld
  
  #
  # Name resolver library.  Included when loading xntpres, which calls
--- 73,87 ----
  #	previously have installed the CHU serial line discipline in
  #	the kernel of the machine you are doing the compile on.
  #
! # Define -DTRUETIME to include support for the Kinemetrics TrueTime
! #	receiver(s).
! #
! CLOCKDEFS= -DLOCAL_CLOCK
  
  #
  # For MIPS 4.3BSD or RISCos 4.0, include a -lmld to get the nlist() routine
  #
! DAEMONLIBS= -lmld
  
  #
  # Name resolver library.  Included when loading xntpres, which calls
***************
*** 83,94 ****
  # gethostbyname().  Define this if you would rather use a different
  # version of the routine than the one in libc.a
  #
! RESLIB=
  
  #
  # Option flags for the C compiler.  A -g if you are uncomfortable
  #
! COPTS= -O
  
  #
  # C compiler to use.  gcc will work, but avoid the -fstrength-reduce option
--- 88,100 ----
  # gethostbyname().  Define this if you would rather use a different
  # version of the routine than the one in libc.a
  #
! RESLIB= -lsun
  
  #
  # Option flags for the C compiler.  A -g if you are uncomfortable
  #
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! #COPTS= -g -DDEBUG -D_BSD_COMPAT
  
  #
  # C compiler to use.  gcc will work, but avoid the -fstrength-reduce option
***************
*** 101,104 ****
  #
  # Directory into which binaries should be installed
  #
! BINDIR=	/local/etc
--- 107,112 ----
  #
  # Directory into which binaries should be installed
  #
! BINDIR=	/usr/etc
! CONFIGDIR = /usr/etc
! CONFIG_FN= ntp.conf
diff -cr ../louie/Makefile ./Makefile
*** ../louie/Makefile	Tue Nov 14 09:09:18 1989
--- ./Makefile	Wed Oct 10 11:06:13 1990
***************
*** 30,36 ****
  	cd lib ; $(MAKE) $(MFLAGS)
  
  neat:
! 	rm -f $(CONF).sed eddep makedep Makefile.bak make.log make.out *.tar
  
  clean:	neat
  	cd xntpd ; $(MAKE) $(MFLAGS) clean
--- 30,36 ----
  	cd lib ; $(MAKE) $(MFLAGS)
  
  neat:
! 	- rm -f $(CONF).sed eddep makedep Makefile.bak make.log make.out *.tar
  
  clean:	neat
  	cd xntpd ; $(MAKE) $(MFLAGS) clean
Only in .: README-SGI
*** /dev/null	Wed Jun 26 05:02:40 1991
--- README-SGI	Wed Jun 26 10:11:59 1991
***************
*** 0 ****
--- 1,32 ----
+ The files in the install/ directory are an aid in making xntpd run
+ automatically, and get started on a boot. My Makefile and Config put all
+ config files and binaries in /usr/etc (the normal place for networking
+ config files).  Startup scripts are placed in /etc/init.d with symlinks
+ from /etc/rc[02].d/. I have included sample config files in this
+ directory.
+ 
+ To make this work, edit the file install/init.d_ntp and replace the line
+ 
+ NTPSERVS="ntp0 ntp1 ntp2 ntp3 ntp4 ntp5 ntp6 ntp7 ntp8 ntp9"
+ 
+ with a list of your own ntp servers. Similarly edit the file
+ install/ntp.conf.x. You will need to be running xntpres to use names
+ rather than addresses, and xntpres needs the file ntp.keys, so put in your
+ own passwords there.
+ 
+ To install xntp and get it running on an IRIS (3.3 and later are all I've
+ tested), basically execute the following script:
+ 
+ su
+ cp xntpd/xntpd /usr/etc
+ cp xntpres/xntpres /usr/etc
+ cp xntpdc/xntpdc /usr/etc
+ cp ntpdate/ntpdate /usr/etc
+ cp install/ntp.conf.x /usr/etc/ntp.conf
+ cp install/ntp.keys.x /usr/etc/ntp.keys
+ cp install/init.d_ntp /etc/init.d/ntp
+ chmod a+x /etc/init.d/ntp
+ ln -s /etc/init.d/ntp /etc/rc2.d/S35ntp
+ ln -s /etc/init.d/ntp /etc/rc0.d/K35ntp
+ chkconfig ntp on
+ /etc/init.d/ntp start
Common subdirectories: ../louie/authstuff and ./authstuff
Common subdirectories: ../louie/clockstuff and ./clockstuff
Common subdirectories: ../louie/conf and ./conf
Common subdirectories: ../louie/doc and ./doc
Common subdirectories: ../louie/gizmo and ./gizmo
Common subdirectories: ../louie/include and ./include
Only in .: install
*** /dev/null	Wed Jun 26 05:02:40 1991
--- install/init.d_ntp	Wed Jun 26 10:02:00 1991
***************
*** 0 ****
--- 1,51 ----
+ #! /bin/sh
+ #
+ # Start or stop the NTP daemon
+ #
+ 
+ IS_ON=/etc/chkconfig
+ NTPD=xntpd
+ NTPDPATH=/usr/etc
+ CONF=/etc/config
+ NTPSERVS="ntp0 ntp1 ntp2 ntp3 ntp4 ntp5 ntp6 ntp7 ntp8 ntp9"
+ 
+ if $IS_ON verbose ; then
+ 	ECHO=echo
+ 	VERBOSE=-v
+ else		# For a quiet startup and shutdown
+ 	ECHO=:
+ 	VERBOSE=
+ fi
+ 
+ case "$1" in
+   'start')
+ 	/etc/killall $NTPD
+ 	if $IS_ON ntp && test -x $NTPDPATH/$NTPD; then
+ 		if $IS_ON verbose ; then
+ 			$NTPDPATH/ntpdate $NTPSERVS 2>/dev/null
+ 		else
+ 			$NTPDPATH/ntpdate $NTPSERVS >/dev/null 2>&1
+ 		fi
+ 		if test -f $CONF/ntp.options; then
+ 			$NTPDPATH/$NTPD `cat $CONF/ntp.options` > /dev/null 2>&1
+ 		elif test -f $NTPDPATH/ntp.conf; then
+ 			$NTPDPATH/$NTPD > /dev/null 2>&1
+ 		else
+ 			$NTPDPATH/$NTPD -b -f $NTPDPATH/ntp.drift
+ 		fi
+ 		if test -f $NTPDPATH/ntp.conf; then
+ 			$ECHO "Network time: $NTPD (configured)"
+ 		else
+ 			$ECHO "Network time: $NTPD (broadcast)"
+ 		fi
+ 	fi
+ 	;;
+ 
+   'stop')
+ 	/etc/killall $NTPD
+ 	;;
+ 
+   *)
+ 	echo "usage: $0 {start|stop}"
+ 	;;
+ esac
*** /dev/null	Wed Jun 26 05:02:40 1991
--- install/ntp.conf.x	Wed Jun 26 10:02:41 1991
***************
*** 0 ****
--- 1,26 ----
+ # distribution configuration file for xntp leaf nodes at SGI
+ #   scotth 90.11.30
+ 
+ # these are aliases to server machines in the local domain
+ server ntp0
+ server ntp1
+ server ntp2
+ server ntp3
+ server ntp4
+ server ntp5
+ server ntp6
+ server ntp7
+ server ntp8
+ server ntp9
+ 
+ driftfile /usr/etc/ntp.drift
+ 
+ monitor no
+ 
+ requestkey 1234
+ controlkey 2468
+ keys /usr/etc/ntp.keys
+ 
+ resolver /usr/etc/xntpres
+ 
+ broadcastclient yes
*** /dev/null	Wed Jun 26 05:02:40 1991
--- install/ntp.keys.x	Wed Jun 26 10:11:03 1991
***************
*** 0 ****
--- 1,2 ----
+ 1234 A trythis
+ 2468 A orthat
Common subdirectories: ../louie/kernel and ./kernel
Common subdirectories: ../louie/lib and ./lib
Common subdirectories: ../louie/ntpdate and ./ntpdate
Common subdirectories: ../louie/ntpq and ./ntpq
Common subdirectories: ../louie/util and ./util
Common subdirectories: ../louie/xntpd and ./xntpd
Common subdirectories: ../louie/xntpdc and ./xntpdc
Common subdirectories: ../louie/xntpres and ./xntpres
diff -cr ../louie/authstuff/Makefile ./authstuff/Makefile
*** ../louie/authstuff/Makefile	Tue Nov 14 10:45:23 1989
--- ./authstuff/Makefile	Sun Apr  7 22:29:30 1991
***************
*** 3,11 ****
  # authcert, authspeed - authentication utilities
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,11 ----
  # authcert, authspeed - authentication utilities
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
diff -cr ../louie/clockstuff/Makefile ./clockstuff/Makefile
*** ../louie/clockstuff/Makefile	Tue Nov 14 10:45:25 1989
--- ./clockstuff/Makefile	Sun Apr  7 22:29:31 1991
***************
*** 3,11 ****
  # Makefile for clock miscellany
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,11 ----
  # Makefile for clock miscellany
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 31,37 ****
  	$(CC) $(COPTS) -o $@ $(CLKOBJS) $(LIB)
  
  install:	$(PROGRAM)
! #	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 31,37 ----
  	$(CC) $(COPTS) -o $@ $(CLKOBJS) $(LIB)
  
  install:	$(PROGRAM)
! #	install -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
diff -cr ../louie/include/ntp.h ./include/ntp.h
*** ../louie/include/ntp.h	Thu Oct 26 14:17:36 1989
--- ./include/ntp.h	Mon Mar 11 08:45:42 1991
***************
*** 56,62 ****
--- 56,68 ----
  #define	CLOCK_COMP	4	/* compliance maximum: 2**4 */
  #define	CLOCK_FACTOR	18	/* compliance factor: 2**18 */
  
+ #ifndef CLOCK_MAX_F
+ #if defined(convex)
+ #define	CLOCK_MAX_F	0x5999999a	/* 350 ms, in time stamp format */
+ #else
  #define	CLOCK_MAX_F	0x20c49ba6	/* 128 ms, in time stamp format */
+ #endif
+ #endif
  #define	CLOCK_MAX_I	0x0		/* both fractional and integral parts */
  
  #define	CLOCK_WAYTOOBIG	1000		/* if clock 1000 sec off, forget it */
diff -cr ../louie/lib/Makefile ./lib/Makefile
*** ../louie/lib/Makefile	Tue Nov 14 10:45:20 1989
--- ./lib/Makefile	Sun Apr  7 22:29:28 1991
***************
*** 3,9 ****
  # xntp routines which are used a lot of places
  #
  COMPILER= cc
! COPTS= -O
  LIBDEFS=	-DBIG_ENDIAN
  RANLIB=		ranlib # : ar does the work of ranlib under System V
  #
--- 3,9 ----
  # xntp routines which are used a lot of places
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
  LIBDEFS=	-DBIG_ENDIAN
  RANLIB=		ranlib # : ar does the work of ranlib under System V
  #
***************
*** 36,42 ****
  $(LIBNAME).a:	$(OBJS)
  	ar rv $@ $?
  	rm -f $?
! 	ranlib $@
  
  lintlib:	llib-l$(LIBNAME).ln
  
--- 36,42 ----
  $(LIBNAME).a:	$(OBJS)
  	ar rv $@ $?
  	rm -f $?
! 	-ranlib $@
  
  lintlib:	llib-l$(LIBNAME).ln
  
diff -cr ../louie/lib/emalloc.c ./lib/emalloc.c
*** ../louie/lib/emalloc.c	Tue Jul 18 14:34:44 1989
--- ./lib/emalloc.c	Mon Mar  4 13:17:18 1991
***************
*** 11,17 ****
  	char *mem;
  	extern char *malloc();
  
! 	if ((mem = malloc(size)) == 0) {
  		syslog(LOG_ERR, "No more memory!");
  		exit(1);
  	}
--- 11,17 ----
  	char *mem;
  	extern char *malloc();
  
! 	if ((mem = malloc(size+1)) == 0) {
  		syslog(LOG_ERR, "No more memory!");
  		exit(1);
  	}
diff -cr ../louie/ntpdate/Makefile ./ntpdate/Makefile
*** ../louie/ntpdate/Makefile	Tue Nov 14 10:45:22 1989
--- ./ntpdate/Makefile	Tue Apr 16 15:42:30 1991
***************
*** 3,11 ****
  # ntpdate - private mode query program for ntpdate
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,11 ----
  # ntpdate - private mode query program for ntpdate
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 23,29 ****
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 23,29 ----
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB)
  
  install:	$(PROGRAM)
! 	$(INSTALL) -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
diff -cr ../louie/ntpq/Makefile ./ntpq/Makefile
*** ../louie/ntpq/Makefile	Tue Nov 14 10:45:24 1989
--- ./ntpq/Makefile	Tue Apr 16 15:42:45 1991
***************
*** 3,11 ****
  # ntpq - control mode query program
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,11 ----
  # ntpq - control mode query program
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 23,29 ****
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 23,29 ----
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB)
  
  install:	$(PROGRAM)
! 	$(INSTALL) -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
diff -cr ../louie/util/Makefile ./util/Makefile
*** ../louie/util/Makefile	Tue Nov 14 10:45:26 1989
--- ./util/Makefile	Tue Apr 23 10:48:59 1991
***************
*** 1,12 ****
! PROGRAM=	tickadj
  #
  # Makefile for utilities
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
! DAEMONLIBS= # -lmld
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 1,12 ----
! PROGRAM=	
  #
  # Makefile for utilities
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
! DAEMONLIBS= -lmld
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 20,30 ****
  
  all:	$(PROGRAM)
  
! $(PROGRAM): $(OBJS)
! 	$(CC) $(COPTS) -o $@ $(OBJS) $(DAEMONLIBS)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 20,48 ----
  
  all:	$(PROGRAM)
  
! tickadj:	tickadj.c
! 	$(CC) $(COPTS) -o tickadj tickadj.c  $(DAEMONLIBS)
  
+ fromlfp:	fromlfp.c ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o fromlfp fromlfp.c -L../lib -lm -lntp
+ 
+ tolfp:	tolfp.c ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o tolfp tolfp.c -L../lib -lm -lntp
+ 
+ totrim:	totrim.c ../xntpd/ntp_sgi.h ../xntpd/ntp_sgi.o ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o totrim totrim.c ../xntpd/ntp_sgi.o -L../lib -lm -lntp
+ 
+ fromtrim:	fromtrim.c ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o fromtrim fromtrim.c -L../lib -lm -lntp
+ 
+ tous:	tous.c ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o tous tous.c -L../lib -lm -lntp
+ 
+ fromus:	fromus.c ../include/ntp_fp.h ../include/ntp_unixtime.h
+ 	$(CC) $(CFLAGS) -o fromus fromus.c -L../lib -lm -lntp
+ 
  install:	$(PROGRAM)
! 	install -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
Only in ./util: dst-test.c
Only in ./util: fromlfp.c
Only in ./util: fromtrim.c
Only in ./util: fromus.c
Only in ./util: tolfp.c
Only in ./util: totrim.c
Only in ./util: tous.c
diff -cr ../louie/xntpd/Makefile ./xntpd/Makefile
*** ../louie/xntpd/Makefile	Tue Nov 14 10:45:21 1989
--- ./xntpd/Makefile	Tue Apr 16 15:41:26 1991
***************
*** 3,13 ****
  # xntpd - NTP daemon
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
! CLOCKDEFS=
! DAEMONLIBS= # -lmld
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,14 ----
  # xntpd - NTP daemon
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! CONFIGDIR= /usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
! CLOCKDEFS= -DLOCAL_CLOCK
! DAEMONLIBS= -lmld
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 21,27 ****
  	ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \
  	ntp_unixclock.c ntp_util.c ntpd.c refclock_chu.c \
  	refclock_conf.c refclock_local.c refclock_pst.c \
! 	refclock_wwvb.c
  
  OBJS=	ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \
  	ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \
--- 22,29 ----
  	ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \
  	ntp_unixclock.c ntp_util.c ntpd.c refclock_chu.c \
  	refclock_conf.c refclock_local.c refclock_pst.c \
! 	refclock_wwvb.c \
! 	ntp_sgi.c
  
  OBJS=	ntp_config.o ntp_control.o ntp_io.o ntp_leap.o \
  	ntp_loopfilter.o ntp_monitor.o ntp_peer.o ntp_proto.o \
***************
*** 28,34 ****
  	ntp_refclock.o ntp_request.o ntp_restrict.o ntp_timer.o \
  	ntp_unixclock.o ntp_util.o ntpd.o refclock_chu.o \
  	refclock_conf.o refclock_local.o refclock_pst.o \
! 	refclock_wwvb.o
  
  all:	$(PROGRAM)
  
--- 30,37 ----
  	ntp_refclock.o ntp_request.o ntp_restrict.o ntp_timer.o \
  	ntp_unixclock.o ntp_util.o ntpd.o refclock_chu.o \
  	refclock_conf.o refclock_local.o refclock_pst.o \
! 	refclock_wwvb.o \
! 	ntp_sgi.o
  
  all:	$(PROGRAM)
  
***************
*** 36,42 ****
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(DAEMONLIBS)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 39,45 ----
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(DAEMONLIBS)
  
  install:	$(PROGRAM)
! 	$(INSTALL) -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
***************
*** 74,76 ****
--- 77,81 ----
  refclock_wwvb.o:	refclock_wwvb.c
  	$(CC) $(COPTS) $(DEFS) $(CLOCKDEFS) $(INCL) -c $*.c
  
+ refclock_truetime.o:	refclock_truetime.c
+ 	$(CC) $(COPTS) $(DEFS) $(CLOCKDEFS) $(INCL) -c $*.c
diff -cr ../louie/xntpd/ntp_config.c ./xntpd/ntp_config.c
*** ../louie/xntpd/ntp_config.c	Tue Nov 14 10:16:16 1989
--- ./xntpd/ntp_config.c	Fri Mar 29 10:22:00 1991
***************
*** 221,227 ****
--- 221,232 ----
  extern int debug;
  #endif
  char *progname;
+ #ifdef sgi
+ char *sgi_timetrim_file;
+ char *xntp_options = "abc:de:f:k:r:t:P:";
+ #else
  char *xntp_options = "abc:de:f:k:r:t:";
+ #endif
  
  
  /*
***************
*** 426,431 ****
--- 431,441 ----
  			} while (0);
  			break;
  
+ #ifdef sgi
+ 		case 'P':
+ 			sgi_timetrim_file = optarg;
+ 			break;
+ #endif /* sgi */
  
  		default:
  			errflg++;
diff -cr ../louie/xntpd/ntp_io.c ./xntpd/ntp_io.c
*** ../louie/xntpd/ntp_io.c	Sun Nov  5 16:24:43 1989
--- ./xntpd/ntp_io.c	Wed Mar  6 08:35:02 1991
***************
*** 18,23 ****
--- 18,26 ----
  #endif
  #include <net/if.h>
  #include <netinet/in.h>
+ #ifdef SIGPOLL
+ #include <sys/stropts.h>
+ #endif
  
  #include "ntp_syslog.h"
  #include "ntp_fp.h"
***************
*** 58,64 ****
--- 61,71 ----
  /*
   * Block the interrupt, for critical sections.
   */
+ #ifdef SIGPOLL
+ #define	BLOCKIO(osig)	(osig = sigblock((sigmask(SIGIO)|sigmask(SIGPOLL))))
+ #else
  #define	BLOCKIO(osig)	(osig = sigblock(sigmask(SIGIO)))
+ #endif
  #define	UNBLOCKIO(osig)	((void) sigsetmask(osig))
  
  /*
***************
*** 165,170 ****
--- 172,180 ----
  	 * Point SIGIO at service routine
  	 */
  	(void) signal(SIGIO, input_handler);
+ #ifdef SIGPOLL
+ 	(void) signal(SIGPOLL, input_handler);
+ #endif
  
  	/*
  	 * Create the sockets
***************
*** 646,651 ****
--- 656,662 ----
  	l_fp ts;
  	fd_set fds;
  	extern void receive();
+ 	int osig;
  
  	handler_calls++;
  
***************
*** 680,685 ****
--- 691,701 ----
  		for (rp = refio; rp != 0 && n > 0; rp = rp->next) {
  			fd = rp->fd;
  			if (FD_ISSET(fd, &fds)) {
+ #ifdef DEBUG
+ 				if (debug > 3) {
+ 					printf("input_handler: fd = %d\n", fd);
+ 				}
+ #endif
  				n--;
  				if (free_recvbufs == 0) {
  					char buf[RX_BUFF_SIZE];
***************
*** 689,713 ****
  					continue;
  				}
  
  				rb = freelist;
  				freelist = rb->next;
  				free_recvbufs--;
  
  				i = (rp->datalen == 0
  				    || rp->datalen > sizeof(rb->recv_space))
  				    ? sizeof(rb->recv_space) : rp->datalen;
! 				
  				rb->recv_length = read(fd,
  				    (char *)&rb->recv_space, i);
  
  				if (rb->recv_length == -1) {
  					syslog(LOG_ERR, "clock read: %m");
  					rb->next = freelist;
  					freelist = rb;
  					free_recvbufs++;
  					continue;
  				}
! 	
  				/*
  				 * Got one.  Mark how and when it got here,
  				 * put it on the full list and do bookkeeping.
--- 705,733 ----
  					continue;
  				}
  
+ 				BLOCKIO(osig);
  				rb = freelist;
  				freelist = rb->next;
  				free_recvbufs--;
+ 				UNBLOCKIO(osig);
  
  				i = (rp->datalen == 0
  				    || rp->datalen > sizeof(rb->recv_space))
  				    ? sizeof(rb->recv_space) : rp->datalen;
! 
  				rb->recv_length = read(fd,
  				    (char *)&rb->recv_space, i);
  
  				if (rb->recv_length == -1) {
  					syslog(LOG_ERR, "clock read: %m");
+ 					BLOCKIO(osig);
  					rb->next = freelist;
  					freelist = rb;
  					free_recvbufs++;
+ 					UNBLOCKIO(osig);
  					continue;
  				}
! 
  				/*
  				 * Got one.  Mark how and when it got here,
  				 * put it on the full list and do bookkeeping.
***************
*** 742,747 ****
--- 762,772 ----
  			}
  			if (FD_ISSET(fd, &fds)) {
  				n--;
+ #ifdef DEBUG
+ 			  if (debug > 3) {
+ 			    printf("input_handler: fd = %d\n", fd);
+ 			  }
+ #endif
  				/*
  				 * Get a buffer and read the frame.  If we
  				 * haven't got a buffer, or this is received
***************
*** 757,767 ****
  						packets_dropped++;
  					continue;
  				}
! 	
  				rb = freelist;
  				freelist = rb->next;
  				free_recvbufs--;
! 	
  				fromlen = sizeof(struct sockaddr_in);
  				rb->recv_length = recvfrom(fd,
  				    (char *)&rb->recv_space,
--- 782,794 ----
  						packets_dropped++;
  					continue;
  				}
! 
! 				BLOCKIO(osig);
  				rb = freelist;
  				freelist = rb->next;
  				free_recvbufs--;
! 				UNBLOCKIO(osig);
! 
  				fromlen = sizeof(struct sockaddr_in);
  				rb->recv_length = recvfrom(fd,
  				    (char *)&rb->recv_space,
***************
*** 768,781 ****
  				    sizeof(rb->recv_space), 0,
  				    (struct sockaddr *)&rb->recv_srcadr,
  				    &fromlen);
! 				if (rb->recv_length == -1) {
  					syslog(LOG_ERR, "recvfrom: %m");
  					rb->next = freelist;
  					freelist = rb;
  					free_recvbufs++;
  					continue;
  				}
! 	
  				/*
  				 * Got one.  Mark how and when it got here,
  				 * put it on the full list and do bookkeeping.
--- 795,814 ----
  				    sizeof(rb->recv_space), 0,
  				    (struct sockaddr *)&rb->recv_srcadr,
  				    &fromlen);
! 				if (rb->recv_length == -1
! #ifdef EWOULDBLOCK
! 				    && errno != EWOULDBLOCK
! #endif
! 				    ) {
  					syslog(LOG_ERR, "recvfrom: %m");
+ 					BLOCKIO(osig);
  					rb->next = freelist;
  					freelist = rb;
  					free_recvbufs++;
+ 					UNBLOCKIO(osig);
  					continue;
  				}
! 
  				/*
  				 * Got one.  Mark how and when it got here,
  				 * put it on the full list and do bookkeeping.
***************
*** 783,793 ****
  				rb->dstadr = &inter_list[i];
  				rb->recv_time = ts;
  				rb->receiver = receive;
! 	
  				rb->next = fulllist;
  				fulllist = rb;
  				full_recvbufs++;
! 	
  				inter_list[i].received++;
  				packets_received++;
  			}
--- 816,826 ----
  				rb->dstadr = &inter_list[i];
  				rb->recv_time = ts;
  				rb->receiver = receive;
! 
  				rb->next = fulllist;
  				fulllist = rb;
  				full_recvbufs++;
! 
  				inter_list[i].received++;
  				packets_received++;
  			}
***************
*** 857,866 ****
--- 890,901 ----
  	 * less set up.  Make it non-blocking and arrange for the
  	 * delivery of SIGIO interrupts to us.
  	 */
+ #ifndef sgi
  	if (fcntl(rio->fd, F_SETOWN, getpid()) == -1) {
  		syslog(LOG_ERR, "fcntl(F_SETOWN) fails for clock I/O: %m");
  		return 0;
  	}
+ #endif
  
  	BLOCKIO(osig);
  	/*
***************
*** 872,878 ****
--- 907,925 ----
  		return 0;
  	}
  
+ #ifdef SIGPOLL
  	/*
+ 	 * set non-blocking streams I/O and indicate a desire to
+ 	 * receive SIPOLL events on the descriptor
+ 	 */
+ 	if (ioctl(rio->fd, I_SETSIG, S_INPUT) < 0) {
+ 		syslog(LOG_ERR,
+ 		       "ioctl(I_SETSIG, S_INPUT) fails for clock I/O: %m");
+ 		return 0;
+ 	}
+ #endif
+ 
+ 	/*
  	 * Stuff the I/O structure in the list and mark the descriptor
  	 * in use.  There is a harmless (I hope) race condition here.
  	 */
***************
*** 918,923 ****
--- 965,980 ----
  			return;
  		}
  	}
+ 
+ #ifdef SIGPOLL
+ 	/*
+ 	 * unregister interest in streams interrupts
+ 	 */
+ 	if (ioctl(rio->fd, I_SETSIG, 0) < 0) {
+ 		syslog(LOG_ERR,
+ 		       "ioctl(I_SETSIG, 0) error for refclock: %m");
+ 	}
+ #endif
  
  	/*
  	 * Close the descriptor.  close_socket does the right thing despite
diff -cr ../louie/xntpd/ntp_loopfilter.c ./xntpd/ntp_loopfilter.c
*** ../louie/xntpd/ntp_loopfilter.c	Sun Nov  5 14:24:38 1989
--- ./xntpd/ntp_loopfilter.c	Tue Apr 23 10:58:28 1991
***************
*** 9,14 ****
--- 9,17 ----
  #include "ntp_syslog.h"
  #include "ntp_fp.h"
  #include "ntp.h"
+ #ifdef sgi
+ #include "ntp_sgi.h"
+ #endif
  
  /*
   * The loop filter is implemented in slavish adherence to the
***************
*** 116,122 ****
  	 */
  	if (tmp_ui > CLOCK_MAX_I || (tmp_ui == CLOCK_MAX_I
  	    && (u_long)tmp_uf >= (u_long)CLOCK_MAX_F)) {
! 		syslog(LOG_DEBUG, "adjust: STEP %s offset %s\n",
  		    ntoa(from), lfptoa(fp_offset));
  		step_systime(fp_offset);
  
--- 119,125 ----
  	 */
  	if (tmp_ui > CLOCK_MAX_I || (tmp_ui == CLOCK_MAX_I
  	    && (u_long)tmp_uf >= (u_long)CLOCK_MAX_F)) {
! 		syslog(LOG_INFO, "adjust: STEP %s offset %s\n",
  		    ntoa(from), lfptoa(fp_offset));
  		step_systime(fp_offset);
  
***************
*** 267,273 ****
--- 270,297 ----
  {
  	switch (item) {
  	case LOOP_DRIFTCOMP:
+ #ifdef sgi
+ 		/*
+ 		 * convert the ntp.drift compensation into a timetrim value.
+ 		 * if timetrim is not zero when we start, then we assume that
+ 		 * who/whatever set it has a better idea of a starting value
+ 		 * than I do, so don't override it.
+ 		 */
+ 		{
+ 			long old_trim, new_trim;
+ 
+ 			if (0 != syssgi(SGI_GETTIMETRIM, &old_trim)) {
+ 				syslog(LOG_ERR, "Can't get timetrim value: %m");
+ 			}
+ 			if (old_trim == 0) {
+ 				new_trim = lfptotrim( value);
+ 				syssgi(SGI_SETTIMETRIM, new_trim);
+ 			}
+ 			L_CLR(&drift_comp);
+ 		}
+ #else
  		drift_comp = *value;
+ #endif
  		/*
  		 * Assume that drift_comp >> CLOCK_FREQ is small enough
  		 * to fit in a fraction.  Do the shifts all at once.
Only in ./xntpd: ntp_sgi.c
*** /dev/null	Wed Jun 26 05:02:40 1991
--- xntpd/ntp_sgi.c	Tue Apr 23 10:55:31 1991
***************
*** 0 ****
--- 1,120 ----
+ /*
+  * support functions for the xntpd port to Silicon Graphics workstations
+  *
+  * author: scott henry 91.01.08 <scotth at sgi.com>
+  */
+ 
+ #ifdef sgi
+ 
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ 
+ #include "ntp_fp.h"
+ #include "ntp.h"
+ #include "ntp_unixtime.h"
+ #include "ntp_sgi.h"
+ 
+ /*
+  * convert from a timestamp (suitable for ntp.drift value)
+  * to the kernel clock trimming variable timetrim
+  */
+ 
+ extern long tstouslo[];
+ extern long tstousmid[];
+ extern long tstoushi[];
+ 
+ /*
+  * modified version of TSFTOTVU to convert into nsec instead of usec
+  */
+ #define TV_SHIFT	3
+ #define	TSFTOTVN(tsf, tvn) \
+         (tvn) = (tstoushi[((tsf) >> 24) & 0xff] \
+ 	   + tstousmid[((tsf) >> 16) & 0xff] \
+ 	   + tstouslo[((tsf) >> 9) & 0x7f]) * (1000 >> (TV_SHIFT+CLOCK_ADJ))
+ 
+ long
+ lfptotrim( l_fp *lfp)
+ {
+   long drift;
+   long timetrim;
+   int isneg;
+ 
+   drift = (long)((lfp->l_ui << (FRACTION_PREC-CLOCK_FREQ))
+ 			 | (lfp->l_uf >> CLOCK_FREQ));
+   if (drift < 0)
+     {
+       isneg = 1;
+       drift = -drift;
+     }
+   else
+     {
+       isneg = 0;
+     }
+ 
+   /*
+    * Round the adjustment value.
+    */
+   if (lfp->l_uf & (1<<(CLOCK_FREQ-1)))
+     drift++;
+ 
+   TSFTOTVN(drift,timetrim);
+ 
+   if (isneg)
+     timetrim = -timetrim;
+ 
+ return timetrim;
+ }
+ 
+ 
+ /*
+  * convert the kernal clock adjustment variable timetrim
+  * to a timestamp equivalent to the ntp.drift file value
+  */
+ 
+ extern u_long ustotslo[];
+ extern u_long ustotsmid[];
+ extern u_long ustotshi[];
+ 
+ void
+ trimtolfp( long timetrim, l_fp *lfp)
+ {
+   u_long drift;
+   int isneg;
+ 
+   /*
+    * since TVUTOTSF loses the nanosecond portion anyway,
+    * convert timetrim to drift fraction, with some fudges
+    * to try to account for the precision loss
+    */
+   if (timetrim < 0)
+     {
+       isneg = 1;
+       timetrim = -timetrim;
+     }
+   else
+     {
+       isneg = 0;
+     }
+ 
+ #define OVERFLOW (1000000000 >> (CLOCK_FREQ))
+   if (timetrim > OVERFLOW)
+     {
+       lfp->l_ui = timetrim / OVERFLOW;
+       timetrim % OVERFLOW;
+     }
+ 
+   drift = ((timetrim << (CLOCK_FREQ-3)) / (1000>>3));
+   if (timetrim & (0xff))
+     {
+       drift++;			/* round the drift value */
+     }
+ 
+ 
+   TVUTOTSF(drift,lfp->l_uf);
+   if (isneg)
+     {
+       L_NEG(lfp);
+     }
+ }
+ 
+ #endif /* sgi */
Only in ./xntpd: ntp_sgi.h
*** /dev/null	Wed Jun 26 05:02:40 1991
--- xntpd/ntp_sgi.h	Tue Jan  8 14:53:18 1991
***************
*** 0 ****
--- 1,19 ----
+ /*
+  * declare the timetrim <-> timestamp functions
+  * ANSI style declarations
+  */
+ 
+ #ifdef sgi
+ 
+ #include <sys/syssgi.h>
+ 
+ /* make sure that the declaration for l_fp is loaded */
+ /* this is the first #define in the file */
+ #ifndef FRACTION_PREC
+ #include "ntp_fp.h"
+ #endif
+ 
+ long lfptotrim(l_fp*);
+ void trimtolfp( long, l_fp*);
+ 
+ #endif
diff -cr ../louie/xntpd/ntp_unixclock.c ./xntpd/ntp_unixclock.c
*** ../louie/xntpd/ntp_unixclock.c	Wed Oct 25 19:53:06 1989
--- ./xntpd/ntp_unixclock.c	Mon Apr 22 15:01:53 1991
***************
*** 10,15 ****
--- 10,20 ----
  #include <sys/file.h>
  #include <sys/stat.h>
  
+ #ifdef sgi
+ #include <sys/param.h>
+ #include <sys/syssgi.h>
+ #endif
+ 
  #include "ntp_syslog.h"
  #include "ntp_fp.h"
  #include "ntp_unixtime.h"
***************
*** 236,241 ****
--- 241,297 ----
  #endif
  	sys_offset.l_ui = sys_offset.l_uf = 0;
  	
+ #ifdef sgi
+ 	/*
+ 	 * Some machines need a large timetrim in order to sync.
+ 	 * Sometimes the initial guess is poor. The step gives us a
+ 	 * good idea of the error during startup.
+ 	 *
+ 	 * This is being called at most once every 512 (2^9) seconds,
+ 	 * so if the drift is small (we're not adjusting for a big
+ 	 * initial time error) assume the drift was constant over that
+ 	 * interval, and adjust the kernel's timetrim.
+ 	 *
+ 	 * If we are in sync, don't adjust the timetrim
+ 	 */
+ 	{
+ 		extern struct peer *sys_peer;
+ 		long timetrim;
+ 		long old_trim;
+ 
+ 		if (sys_peer == 0 && adjtv.tv_sec < 5 && adjtv.tv_sec > -5) {
+ 
+ 			if (0 != syssgi(SGI_GETTIMETRIM, &old_trim)) {
+ 				syslog(LOG_ERR, "Can't get timetrim value: %m");
+ 			}
+ 			timetrim = adjtv.tv_usec + 1000000*adjtv.tv_sec;
+ 			/*
+ 			 * theoretically, we should adjust the value in timetrim like:
+ 			 *	timetrim = (timetrim * 1000) >> 9;
+ 			 * but in practice this over corrects (sometimes a lot),
+ 			 * so we'll use a smaller value. If I knew of an existing
+ 			 * variable that contains the elapsed time since the last
+ 			 * clock adjustment I'd use it instead of guessing like this.
+ 			 * In fact, it's even worse: a step doesn't always imply
+ 			 * a bad drift. A smaller timetrim adjustment is less bad
+ 			 * in worst-case than a bigger one.
+ 			 */
+ 			/*
+ 			 * I really hate putting in hacks like this
+ 			 */
+ 			timetrim >>= 1;						/* this is just a guess, anyway */
+ 			if (isneg) {
+ 				timetrim = -timetrim + old_trim;
+ 			} else {
+ 				timetrim += old_trim;
+ 			}
+ 			if (0 != syssgi(SGI_SETTIMETRIM, timetrim)) {
+ 				syslog(LOG_ERR, "Can't do step timetrim adjustment (%ld): %m", timetrim);
+ 			}
+ 		}
+ 	}
+ #endif /* sgi */
+ 
  #else
  	/*
  	 * Just add adjustment into the current offset.  The update
***************
*** 350,355 ****
--- 406,412 ----
  
  	if (adjtv.tv_usec == 0)
  		return;
+ 
  	if (adjtime(&adjtv, &oadjtv) != 0)
  		syslog(LOG_ERR, "Can't do time adjustment: %m");
  	if (oadjtv.tv_sec != 0 || oadjtv.tv_usec != 0) {
***************
*** 377,382 ****
--- 434,444 ----
  	u_long *tickadj;
  	u_long *tick;
  {
+ #ifdef sgi
+ 	/* these shouldn't change ... */
+ 	*tickadj = 1;
+ 	*tick = 1000000/HZ;
+ #else /* not sgi */
  	register int i;
  	int kmem;
  	static struct nlist nl[] =
***************
*** 451,455 ****
--- 513,518 ----
  
  #undef	K_TICKADJ
  #undef	K_TICK
+ #endif /* sgi */
  }
  #endif /* !NOKMEM */
diff -cr ../louie/xntpd/ntp_util.c ./xntpd/ntp_util.c
*** ../louie/xntpd/ntp_util.c	Sun Nov  5 16:06:46 1989
--- ./xntpd/ntp_util.c	Thu Mar 28 11:04:23 1991
***************
*** 20,29 ****
  #include "ntp_syslog.h"
  #include "ntp_fp.h"
  #include "ntp.h"
  
- 
  /*
!  * This contains odds and ends.  Right now the only thing you'll find
   * in here is the hourly stats printer and some code to support rereading
   * the keys file, but I may eventually put other things in here such as
   * code to do something with the leap bits.
--- 20,34 ----
  #include "ntp_syslog.h"
  #include "ntp_fp.h"
  #include "ntp.h"
+ #ifdef sgi
+ #include "ntp_sgi.h"
+ /* the name of the file to hold the timetrim info. */
+ extern char *sgi_timetrim_file;
+ static char sgi_timetrim_format[] = "long timetrim = %d;\n";
+ #endif
  
  /*
!  * This contains odds and ends.	 Right now the only thing you'll find
   * in here is the hourly stats printer and some code to support rereading
   * the keys file, but I may eventually put other things in here such as
   * code to do something with the leap bits.
***************
*** 76,84 ****
--- 81,132 ----
  	extern char *lfptoa();
  	extern char *mfptoa();
  
+ #ifdef sgi
+ 	/*
+ 	 * convert drift_comp into an adjustment to timetrim.
+ 	 * write the stats_drift_file to be the drift equivalent
+ 	 * to the adjusted timetrim value.
+ 	 */
+ 	long old_trim, timetrim;
+ 	l_fp temp_fp;
+ 
+ 	if (0 != syssgi(SGI_GETTIMETRIM, &old_trim)) {
+ 		syslog(LOG_ERR, "Can't get timetrim value: %m");
+ 	}
+ 	timetrim = lfptotrim( &drift_comp);
+ 	timetrim += old_trim;
+ 	if (0 != syssgi(SGI_SETTIMETRIM, timetrim)) {
+ 		syslog(LOG_ERR, "Can't do time-trim adjustment: %m");
+ 	}
+ 	/*
+ 	 * If requested, write timetrim into a timed-compatible file
+ 	 */
+ 	if (sgi_timetrim_file != 0) {
+ 		int fd;
+ 		char str[64];
+ 		fd = open(sgi_timetrim_file, O_WRONLY|O_TRUNC|O_CREAT, 0644);
+ 		if (fd == -1) {
+ 			syslog(LOG_ERR, "can't open %s: %m", sgi_timetrim_file);
+ 		} else {
+ 			sprintf(str, sgi_timetrim_format, timetrim);
+ 			write(fd, str, strlen(str));
+ 			close(fd);
+ 		}
+ 	}
+ 
+ 	syslog(LOG_INFO, "hourly check: drift %s compliance %s timetrim %ld",
+ 				 lfptoa(&drift_comp, 8),
+ 				 mfptoa((compliance<0)?(-1):0, compliance, 8),
+ 				 old_trim);
+ 
+ 	L_CLR(&temp_fp);
+ 	trimtolfp(timetrim, &temp_fp);
+ 	L_CLR(&drift_comp);
+ #else
  	syslog(LOG_INFO, "hourly check: drift %s compliance %s",
  		lfptoa(&drift_comp, 8),
  		mfptoa((compliance<0)?(-1):0, compliance, 8));
+ #endif /* sgi */
  	
  	if (stats_drift_file != 0) {
  		fd = open(stats_temp_file, O_WRONLY|O_TRUNC|O_CREAT, 0666);
***************
*** 87,101 ****
  			return;
  		}
  
  		val = lfptoa(&drift_comp, 9);
  		vallen = strlen(val);
  		/*
! 		 * Hack here.  Turn the trailing \0 into a \n and write it.
  		 */
  		val[vallen] = '\n';
  		if (write(fd, val, vallen+1) == -1) {
  			syslog(LOG_ERR, "write to %s failed: %m",
! 			    stats_temp_file);
  			(void) close(fd);
  			(void) unlink(stats_temp_file);
  		} else {
--- 135,153 ----
  			return;
  		}
  
+ #ifdef sgi
+ 		val = lfptoa(&temp_fp, 9);
+ #else
  		val = lfptoa(&drift_comp, 9);
+ #endif /* sgi */
  		vallen = strlen(val);
  		/*
! 		 * Hack here.	 Turn the trailing \0 into a \n and write it.
  		 */
  		val[vallen] = '\n';
  		if (write(fd, val, vallen+1) == -1) {
  			syslog(LOG_ERR, "write to %s failed: %m",
! 					stats_temp_file);
  			(void) close(fd);
  			(void) unlink(stats_temp_file);
  		} else {
***************
*** 151,163 ****
  		if ((fp = fopen(stats_drift_file, "r")) == NULL) {
  			if (errno != ENOENT)
  				syslog(LOG_ERR, "can't open %s: %m",
! 				    stats_drift_file);
  			break;
  		}
  
  		if (fgets(buf, sizeof buf, fp) == NULL) {
  			syslog(LOG_ERR, "can't read %s: %m",
! 			    stats_drift_file);
  			(void) fclose(fp);
  			break;
  		}
--- 203,215 ----
  		if ((fp = fopen(stats_drift_file, "r")) == NULL) {
  			if (errno != ENOENT)
  				syslog(LOG_ERR, "can't open %s: %m",
! 						stats_drift_file);
  			break;
  		}
  
  		if (fgets(buf, sizeof buf, fp) == NULL) {
  			syslog(LOG_ERR, "can't read %s: %m",
! 					stats_drift_file);
  			(void) fclose(fp);
  			break;
  		}
***************
*** 165,171 ****
  		(void) fclose(fp);
  
  		/*
! 		 * We allow leading spaces, then the number.  Terminate
  		 * at any trailing space or string terminator.
  		 */
  		cp = buf;
--- 217,223 ----
  		(void) fclose(fp);
  
  		/*
! 		 * We allow leading spaces, then the number.	Terminate
  		 * at any trailing space or string terminator.
  		 */
  		cp = buf;
***************
*** 181,192 ****
  		}
  
  		/*
! 		 * Finally!  Give value to the loop filter.
  		 */
  #ifdef DEBUG
  		if (debug > 1) {
  			printf("loop_config finds old drift of %s\n",
! 			    lfptoa(&old_drift, 9));
  		}
  #endif
  		loop_config(LOOP_DRIFTCOMP, &old_drift);
--- 233,244 ----
  		}
  
  		/*
! 		 * Finally!	 Give value to the loop filter.
  		 */
  #ifdef DEBUG
  		if (debug > 1) {
  			printf("loop_config finds old drift of %s\n",
! 					lfptoa(&old_drift, 9));
  		}
  #endif
  		loop_config(LOOP_DRIFTCOMP, &old_drift);
diff -cr ../louie/xntpd/ntpd.c ./xntpd/ntpd.c
*** ../louie/xntpd/ntpd.c	Sat Sep 23 14:22:46 1989
--- ./xntpd/ntpd.c	Wed Mar  6 08:42:32 1991
***************
*** 21,32 ****
  #define	sigmask(m)	(1<<(m))
  #endif
  #endif
  
  /*
   * Mask for blocking SIGIO and SIGALRM
   */
  #define	BLOCKSIGMASK	(sigmask(SIGIO)|sigmask(SIGALRM))
! 
  /*
   * Signals we catch for debugging.  If not debugging we ignore them.
   */
--- 21,38 ----
  #define	sigmask(m)	(1<<(m))
  #endif
  #endif
+ #ifdef sgi
+ #include <sys/lock.h>
+ #endif
  
  /*
   * Mask for blocking SIGIO and SIGALRM
   */
+ #ifdef SIGPOLL
+ #define	BLOCKSIGMASK	(sigmask(SIGIO)|sigmask(SIGALRM)|sigmask(SIGPOLL))
+ #else
  #define	BLOCKSIGMASK	(sigmask(SIGIO)|sigmask(SIGALRM))
! #endif
  /*
   * Signals we catch for debugging.  If not debugging we ignore them.
   */
***************
*** 226,232 ****
--- 232,251 ----
  	 */
  	report_event(EVNT_SYSRESTART, (struct peer *)0);
  
+ #ifdef sgi
  	/*
+ 	 * lets lock ourself in memory to avoid (or at least minimize)
+ 	 * paging-related problems. Note that because of limitations of
+ 	 * the system call, that anything malloc-ed after the call may
+ 	 * not be locked.
+ 	 */
+ 	if (plock(PROCLOCK))
+ 		{
+ 			syslog(LOG_WARNING, "unable to lock process: %m");
+ 		}
+ #endif
+ 
+ 	/*
  	 * Done all the preparation stuff, now the real thing.  We block
  	 * SIGIO and SIGALRM and check to see if either has occured.
  	 * If not, we pause until one or the other does.  We then call
***************
*** 274,279 ****
--- 293,304 ----
  		while (rbuflist != (struct recvbuf *)0) {
  			rbuf = rbuflist;
  			rbuflist = rbuf->next;
+ #ifdef DEBUG
+ 			if (debug > 3) {
+ 			  printf("main: rbuf->recv_srcclock = 0X%x\n",
+ 				 rbuf->recv_srcclock);
+ 			}
+ #endif
  			(rbuf->receiver)(rbuf);
  			freerecvbuf(rbuf);
  		}
diff -cr ../louie/xntpd/refclock_conf.c ./xntpd/refclock_conf.c
*** ../louie/xntpd/refclock_conf.c	Wed Oct 25 18:22:13 1989
--- ./xntpd/refclock_conf.c	Tue Feb 19 08:31:31 1991
***************
*** 33,43 ****
  
  #ifdef WWVB
  extern int wwvb_start();
! extern void wwvb_shutdown(), wwvb_poll(), wwvb_leap(), wwvb_control();
  extern void wwvb_init(), wwvb_buginfo();
  #endif
  
  
  /*
   * Order is clock_start(), clock_shutdown(), clock_poll(), clock_leap(),
   * clock_control(), clock_init(), clock_xmitinterval, clock_flags;
--- 33,49 ----
  
  #ifdef WWVB
  extern int wwvb_start();
! extern void wwvb_shutdown(), /* wwvb_poll(), */ wwvb_leap(), wwvb_control();
  extern void wwvb_init(), wwvb_buginfo();
  #endif
  
+ #ifdef TRUETIME
+ extern int truetime_start();
+ extern void truetime_shutdown(), truetime_leap(), truetime_control();
+ extern void truetime_init(), truetime_buginfo();
+ #endif
  
+ 
  /*
   * Order is clock_start(), clock_shutdown(), clock_poll(), clock_leap(),
   * clock_control(), clock_init(), clock_xmitinterval, clock_flags;
***************
*** 68,74 ****
  #endif
  
  #ifdef WWVB
! 	{ wwvb_start, wwvb_shutdown, wwvb_poll, wwvb_leap,
  	  wwvb_control, wwvb_init, wwvb_buginfo, STDPOLL, NOFLAGS },
  #else
  	{ noentry, noentry, noentry, noentry,	/* 4 REFCLOCK_WWVB_SPECTRACOM */
--- 74,80 ----
  #endif
  
  #ifdef WWVB
! 	{ wwvb_start, wwvb_shutdown, noentry, wwvb_leap,
  	  wwvb_control, wwvb_init, wwvb_buginfo, STDPOLL, NOFLAGS },
  #else
  	{ noentry, noentry, noentry, noentry,	/* 4 REFCLOCK_WWVB_SPECTRACOM */
***************
*** 75,82 ****
--- 81,93 ----
  	  noentry, noentry, noentry, NOPOLL, NOFLAGS },
  #endif
  
+ #ifdef TRUETIME
+ 	{ truetime_start, truetime_shutdown, noentry, truetime_leap,
+ 	  truetime_control, truetime_init, truetime_buginfo, NOPOLL, NOFLAGS },
+ #else
  	{ noentry, noentry, noentry, noentry,	/* 5 REFCLOCK_GOES_TRUETIME */
  	  noentry, noentry, noentry, NOPOLL, NOFLAGS },
+ #endif
  
  	{ noentry, noentry, noentry, noentry,	/* 6 REFCLOCK_GOES_TRAK */
  	  noentry, noentry, noentry, NOPOLL, NOFLAGS },
Only in ./xntpd: refclock_truetime.c
diff -cr ../louie/xntpdc/Makefile ./xntpdc/Makefile
*** ../louie/xntpdc/Makefile	Tue Nov 14 10:45:22 1989
--- ./xntpdc/Makefile	Tue Apr 16 15:41:49 1991
***************
*** 3,11 ****
  # xntpdc - private mode query program for xntp
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,12 ----
  # xntpdc - private mode query program for xntp
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
! SYSLIBS= -lsun
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 20,29 ****
  all:	$(PROGRAM)
  
  $(PROGRAM): $(OBJS) version.o $(LIB)
! 	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 21,30 ----
  all:	$(PROGRAM)
  
  $(PROGRAM): $(OBJS) version.o $(LIB)
! 	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(SYSLIBS)
  
  install:	$(PROGRAM)
! 	$(INSTALL) -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
diff -cr ../louie/xntpres/Makefile ./xntpres/Makefile
*** ../louie/xntpres/Makefile	Tue Nov 14 10:45:25 1989
--- ./xntpres/Makefile	Tue Apr 16 15:42:04 1991
***************
*** 3,12 ****
  # xntpres - name resolver support for xntpd
  #
  COMPILER= cc
! COPTS= -O
! BINDIR=	/local/etc
! DEFS= # -DNO_SIGNED_CHAR_DECL
! RESLIB=
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
--- 3,12 ----
  # xntpres - name resolver support for xntpd
  #
  COMPILER= cc
! COPTS= -O2 -g3 -D_BSD_SIGNALS
! BINDIR=	/usr/etc
! DEFS= -DCONFIG_FILE=\"/usr/etc/ntp.conf\" -DKEYFILE=\"/usr/etc/ntp.keys\" -DADJTIME_IS_ACCURATE
! RESLIB= -lsun
  #
  INCL=		-I../include
  CFLAGS=		$(COPTS) $(DEFS) $(INCL)
***************
*** 24,30 ****
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(RESLIB)
  
  install:	$(PROGRAM)
! 	install -c -m 0755 $(PROGRAM) $(BINDIR)
  
  tags:
  	ctags *.c *.h
--- 24,30 ----
  	$(CC) $(COPTS) -o $@ $(OBJS) version.o $(LIB) $(RESLIB)
  
  install:	$(PROGRAM)
! 	$(INSTALL) -m 0755 -F $(BINDIR) $(PROGRAM)
  
  tags:
  	ctags *.c *.h
==
--
 Scott Henry <scotth at sgi.com> / Traveller on Dragon Wings
 Information Services,       / Help! My disclaimer is missing!
 Silicon Graphics, Inc      / Politicians no baka!



More information about the Comp.sys.sgi mailing list