[comp.sys.apollo] xntp patches for apollo SR10.2

sommerfeld@apollo.hp.com (Bill Sommerfeld) (03/29/90)

NTP is the Network Time Protocol, a time synchronization protocol in
use on the Internet; xntp is an implementation of NTP for UNIX
systems.  This message includes patches to xntp to allow it to run on
Apollo systems running Domain/OS SR10.2 and later.

Note that xntp and xntpd are *not* supported by myself or by
HP/Apollo; use it at your own risk; however, if you do have any
problems with this software, I'm interested in hearing about them;
send a *complete* report including as much information as possible
about the problem via email at sommerfeld@apollo.com

The base sources to which these patches can be applied was obtained by
anonymous FTP from gw.ccie.utoronto.ca, in pub/ntp/xntp.tar.Z.  Those
interested in the details of the protocol will probably want to pick
up the Internet Request for Comments 1119 (RFC1119); these are
available from a number of places on the Internet, including by
anonymous FTP from NIC.DDN.MIL in the RFC: directory.

You may want to join an Internet mailing list about NTP; send mail to
ntp-request@trantor.umd.edu to join.  Announcements of new versions of
ntp software and much other discussion happens on that list.

Those configuring clocks on the Internet should fetch pub/ntp/ntpinfo
and pub/ntp/clock.txt from louie.udel.edu for some advice.

I'm not aware of any non-Internet sites which have xntp available for
anonymous UUCP, so you're probably SOL if you're not connected to the
Internet (please don't ask me to post sources; they're over 1MB
uncompressed).

What works:

Support for both unicast and broadcast NTP has been tested with these
patches; it has been built on both 680x0 and PRISM systems.  Support
for reference clocks has not been tested, although it might work;
people with a spare radio clock are encouraged to try it out.

Known bugs:

XNTPD uses asynchronous I/O (aka SIGIO).  There is a bug in the "short
circuit" support for asynchronous UDP at SR10.2 and before; in order
to run ntpq, xntpdc, and other programs that may talk to the daemon on
the same host as the daemon, you need to either: a) turn on the lo0
("loopback") interface in /etc/rc.local and communicate with
"localhost" b) run these programs as root.

To build on an SR10.2 system, you need to do the following in the
BSD4.3 environment:

 - fetch and unpack the source tar file.
 - read the documentation and man pages in doc/*
 - apply the enclosed patches, either by hand or with "patch".
 - edit Config to include the appropriate definitions; 
    you *must* include -DNOKMEM in DEFS; you might need to use
    -DNO_SIGNED_CHAR_DECL as well depending on which version of the
    C compiler you have.
 - apply the config file to the makefiles by running "make makefiles"
 - build the system by using "make".

See the README file in the sources for additional information.

*** xntpd/ntp_io.c/1	Sun Nov  5 19:24:42 1989
--- xntpd/ntp_io.c	Fri Mar 23 15:43:38 1990
***************
*** 339,346 ****
--- 339,348 ----
  			continue;
  		if (inter_list[i].flags & INT_BCASTOPEN)
  			continue;
+ #ifndef apollo
  		inter_list[i].bfd = open_socket(&inter_list[i].bcast, 0);
  		inter_list[i].flags |= INT_BCASTOPEN;
+ #endif
  	}
  }
  
***************
*** 744,753 ****
  				n--;
  				/*
  				 * Get a buffer and read the frame.  If we
! 				 * haven't got a buffer, or this is received
! 				 * on the wild card socket, just dump the packet.
  				 */
! 				if (i == 0 || free_recvbufs == 0) {
  					char buf[RX_BUFF_SIZE];
  
  					(void) read(fd, buf, sizeof buf);
--- 746,763 ----
  				n--;
  				/*
  				 * Get a buffer and read the frame.  If we
! 				 * haven't got a buffer,
! #ifndef apollo
! 				 * or this is received
! 				 * on the wild card socket,
! #endif
! 				 * just dump the packet.
  				 */
! 				if (
! #ifndef apollo
! 				    i == 0 ||
! #endif
! 				    free_recvbufs == 0) {
  					char buf[RX_BUFF_SIZE];
  
  					(void) read(fd, buf, sizeof buf);
*** xntpd/ntp_unixclock.c/1	Wed Oct 25 22:53:05 1989
--- xntpd/ntp_unixclock.c	Fri Mar 23 00:55:06 1990
***************
*** 4,10 ****
--- 4,12 ----
   */
  
  #include <stdio.h>
+ #ifndef NOKMEM
  #include <nlist.h>
+ #endif
  #include <sys/types.h>
  #include <sys/time.h>
  #include <sys/file.h>
***************
*** 365,371 ****
  
  
  
! #ifndef NOKMEM
  /*
   * clock_parms - return the local clock tickadj and tick parameters
   *
--- 367,405 ----
  
  
  
! #ifdef NOKMEM
! /*
!  * clock_parms - return the local clock tickadj and tick parameters.
!  *
!  * Note that this version requires the correct constants to be set at
!  * compile time.
!  */
! void
! clock_parms(tickadj, tick)
! 	u_long *tickadj;
!         u_long *tick;
! {
! #ifndef HZ
! #define HZ	60
! #endif
! 
! #ifndef TICKADJ
! #define TICKADJ 668		/* correct for apollo SR10.2 ... */
! #endif
! 
! 	*tickadj = TICKADJ;
! 	*tick = 1000000L / HZ;
! #ifdef	DEBUG
! 	if (debug) {
! 		printf("NOTE: Using preset values for tick and tickadj !!\n");
! 		printf("kernel vars: tickadj = %d, tick = %d\n",
! 		       *tickadj, *tick);
! 	}
! #endif
! }
! 
!     
! #else
  /*
   * clock_parms - return the local clock tickadj and tick parameters
   *
*** xntpd/ntpd.c/1	Sat Sep 23 17:22:45 1989
--- xntpd/ntpd.c	Fri Mar 23 00:38:51 1990
***************
*** 119,124 ****
--- 119,125 ----
  				(void) ioctl(s, (u_long) TIOCNOTTY, (char *) 0);
  				(void) close(s);
  			}
+ 			(void) setpgrp(0, getpid());
  		}
  #ifdef	DEBUG
  	}