Replied: Thu, 15 May 1997 22:58:18 -0400
Replied: "Christos Zoulas <christos@deshaw.com> "
Replied: Sun, 04 May 1997 01:40:41 -0400
Replied: "Christos Zoulas <christos@deshaw.com> "
Received: from copland.udel.edu by huey.udel.edu id aa07088; 20 Apr 97 23:04 EDT
Received: from ramoth.nyc.deshaw.com (root@ramoth.nyc.deshaw.com [149.77.15.102]) by copland.udel.edu (8.8.5/8.7.3) with ESMTP id XAA06834 for <mills@udel.edu>; Sun, 20 Apr 1997 23:04:09 -0400 (EDT)
Received: (from christos@localhost)
 by ramoth.nyc.deshaw.com (8.8.5/8.7.Alpha.4/1.34.kim) id XAA13852
 for mills@udel.edu; Sun, 20 Apr 1997 23:04:02 -0400 (EDT)
Message-Id: <199704210304.XAA13852@ramoth.nyc.deshaw.com>
From: Christos Zoulas <christos@deshaw.com>
Date: Sun, 20 Apr 1997 23:04:01 -0400
Organization: D. E. Shaw & Co.
X-Address: Tower 45, 120 West 45th St., 39th Floor, New York, N.Y. 10036
X-Phone: (212) 478 0000
X-Fax: (212) 478 0101
X-Face:  %jL.CVv-*"-d?@xSu)#i[QzHK3,c?Qx,G.u#bZ;O'qSg"$LmB})v;&A"6r&;#2NRahSRwYl
  D9Y8"L97FX^O7oBy?'hA6-1AQA`L(c[yqZySfl/t&4;gHT1|X\ElkgxMV<G<Wl4Bw[Y^/8]X@>NUjM
  /A)InAN\hPuhymGG{1&&ay2c"[4z_*Gb?{gbnv5+?terjcRFl`(^3vO-^Mw%\Cfk`p{@!a3&/NR#*p
  <c]7@{DT)R_*g4#M@G98-f$hN#J<pnDfR:xx<ph,7HcR3TeE|G~&}*>fH0rostE1
X-Mailer: Mail User's Shell (7.2.6 beta(2)+dynamic 2/29/96)
To: mills@udel.edu
Subject: another xntpd patch


This adds supports for getting tick and tickadj from sysctl() instead of
kvm. This is better, because we don't explicitly know the size of the
kernel variables (this broke on the alpha).

christos

*** ntp_unixclock.c.orig	Fri Apr 18 09:42:09 1997
--- ntp_unixclock.c	Sun Apr 20 22:30:52 1997
***************
*** 59,64 ****
--- 59,70 ----
  # undef hz
  #endif /* hz */
  
+ #ifdef HAVE_SYSCTL_CLOCKRATE
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
+ #include <sys/time.h>
+ #endif
+ 
  extern int debug;
  /*
   * These routines (init_systime, get_systime, step_systime, adj_systime)
***************
*** 267,272 ****
--- 273,304 ----
   * clock_parms - return the local clock tickadj and tick parameters
   *
   */
+ 
+ #ifdef HAVE_SYSCTL_CLOCKRATE
+ static void
+ clock_parms(ptickadj, ptick)
+     u_long *ptickadj;
+     u_long *ptick;
+ {
+     int mib[2];
+     size_t len;
+     struct clockinfo c;
+     int e;
+ 
+     mib[0] = CTL_KERN;
+     mib[1] = KERN_CLOCKRATE;
+     len = sizeof(c);
+     e = sysctl(mib,2,&c,&len,NULL,0);
+     if (e != 0) {
+ 	NLOG(NLOG_SYSINFO) /* conditional if clause for conditional syslog */
+ 	syslog(LOG_NOTICE, "Could not find clockrate with sysctl\n");
+ 	exit(1);
+     }
+     *ptickadj = c.tickadj;
+     *ptick = c.tick;
+ }
+ #else
+ 
  static void
  clock_parms(ptickadj, ptick)
       u_long *ptickadj;
***************
*** 704,707 ****
--- 736,740 ----
      printf("tick = %ld, tickadj = %ld, hz = %d\n", *ptick, *ptickadj, hz);
  #endif
  }
+ #endif
  #endif /* not VMS */
