aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/xntpd
diff options
context:
space:
mode:
authorDima Ruban <dima@FreeBSD.org>1998-10-19 20:48:08 +0000
committerDima Ruban <dima@FreeBSD.org>1998-10-19 20:48:08 +0000
commit6fc32ef8ee8e173059ecd759b722dcc4d730ef0e (patch)
tree1c1a3af3a5f72981673bb16aaf6e1f8db8004314 /usr.sbin/xntpd
parent830775aaf9437653b9169501cf00e314c0757aa4 (diff)
downloadsrc-6fc32ef8ee8e173059ecd759b722dcc4d730ef0e.tar.gz
src-6fc32ef8ee8e173059ecd759b722dcc4d730ef0e.zip
Use sysctl() rather than kvm_read() when getting information
about clock stuff from kernel. This fixes xntpd on alpha.
Notes
Notes: svn path=/head/; revision=40527
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 25de0213b931..0d4267c452a6 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 bc771b6b717f..557ce25eddcb 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