summaryrefslogtreecommitdiffstats
path: root/usr.sbin/xntpd
diff options
context:
space:
mode:
authordima <dima@FreeBSD.org>1998-10-19 20:48:08 +0000
committerdima <dima@FreeBSD.org>1998-10-19 20:48:08 +0000
commit142da85ef5052de403921320b197883828b42117 (patch)
tree815cf352e9b5595ca7584f076025b55cc5cbf24f /usr.sbin/xntpd
parentf651fc063e97f67f9553790548170225307e2c0b (diff)
downloadFreeBSD-src-142da85ef5052de403921320b197883828b42117.zip
FreeBSD-src-142da85ef5052de403921320b197883828b42117.tar.gz
Use sysctl() rather than kvm_read() when getting information
about clock stuff from kernel. This fixes xntpd on alpha.
Diffstat (limited to 'usr.sbin/xntpd')
-rw-r--r--usr.sbin/xntpd/include/ntp_machine.h1
-rw-r--r--usr.sbin/xntpd/xntpd/ntp_unixclock.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/xntpd/include/ntp_machine.h b/usr.sbin/xntpd/include/ntp_machine.h
index 25de021..0d4267c 100644
--- a/usr.sbin/xntpd/include/ntp_machine.h
+++ b/usr.sbin/xntpd/include/ntp_machine.h
@@ -373,6 +373,7 @@ in this file.
#if defined(SYS_44BSD)
#define HAVE_SIGNALED_IO
#define HAVE_LIBKVM
+#define HAVE_SYSCTL
#define NTP_POSIX_SOURCE
#define HAVE_BSD_NICE
#define USE_PROTOTYPES
diff --git a/usr.sbin/xntpd/xntpd/ntp_unixclock.c b/usr.sbin/xntpd/xntpd/ntp_unixclock.c
index bc771b6..557ce25 100644
--- a/usr.sbin/xntpd/xntpd/ntp_unixclock.c
+++ b/usr.sbin/xntpd/xntpd/ntp_unixclock.c
@@ -40,6 +40,12 @@
#undef hz
#endif /* RS6000 */
+#ifdef HAVE_SYSCTL
+#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)
@@ -176,6 +182,27 @@ init_systime()
L_CLR(&sys_clock_offset);
}
+#if defined(HAVE_SYSCTL) && defined(KERN_CLOCKRATE)
+static void
+clock_parms(tickadj, tick)
+ u_long *tickadj;
+ u_long *tick;
+{
+ int mib[2];
+ size_t len;
+ struct clockinfo x;
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_CLOCKRATE;
+ len = sizeof(x);
+ if (sysctl(mib, 2, &x, &len, NULL, 0) == -1) {
+ syslog(LOG_NOTICE, "sysctl(KERN_CLOCKRATE) failed: %m");
+ exit(3);
+ }
+ *tickadj = x.tickadj;
+ *tick = x.tick;
+}
+#else
#ifdef HAVE_LIBKVM
/*
* clock_parms - return the local clock tickadj and tick parameters
@@ -604,3 +631,4 @@ clock_parms(tickadj, tick)
*tick = (u_long)txc.tick;
}
#endif /* SYS_LINUX */
+#endif
OpenPOWER on IntegriCloud