summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-09-27 18:30:26 +0000
committerpst <pst@FreeBSD.org>1994-09-27 18:30:26 +0000
commit9312e22cf5b4e68e7cd5194ab0de35db7c51f66a (patch)
tree3f1cfe106458275e6a56a1077732949bec70f20e /usr.sbin
parentcefcba07fb8a5d3f9d988c797f6772ad539471f4 (diff)
downloadFreeBSD-src-9312e22cf5b4e68e7cd5194ab0de35db7c51f66a.zip
FreeBSD-src-9312e22cf5b4e68e7cd5194ab0de35db7c51f66a.tar.gz
xntpd(8) doesn't know about /kernel (do it right, use get_bootfile()).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/xntpd/Makefile.inc2
-rw-r--r--usr.sbin/xntpd/xntpd/ntp_unixclock.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/xntpd/Makefile.inc b/usr.sbin/xntpd/Makefile.inc
index f38f0a9..28ff220 100644
--- a/usr.sbin/xntpd/Makefile.inc
+++ b/usr.sbin/xntpd/Makefile.inc
@@ -1,5 +1,5 @@
DEFS_LOCAL=-DREFCLOCK -DPARSE
-NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD
+NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD -DHAVE_GETBOOTFILE
AUTHDEFS= -DMD5
CLOCKDEFS= -DLOCAL_CLOCK -DPST -DWWVB -DAS2201 -DGOES -DGPSTM -DOMEGA \
-DLEITCH -DTRAK
diff --git a/usr.sbin/xntpd/xntpd/ntp_unixclock.c b/usr.sbin/xntpd/xntpd/ntp_unixclock.c
index 1950d8c..df728f0 100644
--- a/usr.sbin/xntpd/xntpd/ntp_unixclock.c
+++ b/usr.sbin/xntpd/xntpd/ntp_unixclock.c
@@ -14,6 +14,10 @@
#include <utmp.h>
#endif
+#if defined(HAVE_GETBOOTFILE)
+#include <paths.h>
+#endif
+
#include "ntpd.h"
#include "ntp_io.h"
#include "ntp_unixtime.h"
@@ -309,7 +313,11 @@ clock_parms(tickadj, tick)
{""},
};
#endif
+#ifdef HAVE_GETBOOTFILE
+ const char *kernelname;
+#else
static char *kernelnames[] = {
+ "/kernel",
"/vmunix",
"/unix",
"/mach",
@@ -321,6 +329,7 @@ clock_parms(tickadj, tick)
#endif
NULL
};
+#endif
struct stat stbuf;
int vars[2];
@@ -331,6 +340,11 @@ clock_parms(tickadj, tick)
* Check to see what to use for the object file for names and get
* the locations of the necessary kernel variables.
*/
+#ifdef HAVE_GETBOOTFILE
+ kernelname = getbootfile();
+ if (kernelname &&
+ ((stat(kernelname, &stbuf) == -1) || (nlist(kernelname, nl) < 0))) {
+#else
for (i = 0; kernelnames[i] != NULL; i++) {
if (stat(kernelnames[i], &stbuf) == -1)
continue;
@@ -338,6 +352,7 @@ clock_parms(tickadj, tick)
break;
}
if (kernelnames[i] == NULL) {
+#endif
syslog(LOG_ERR,
"Clock init couldn't find kernel object file");
exit(3);
OpenPOWER on IntegriCloud