diff --git a/usr.sbin/xntpd/Makefile.inc b/usr.sbin/xntpd/Makefile.inc index 0983df967f72..33125f2c34b5 100644 --- a/usr.sbin/xntpd/Makefile.inc +++ b/usr.sbin/xntpd/Makefile.inc @@ -2,6 +2,6 @@ DEFS_LOCAL=-DREFCLOCK -DPARSE NTPDEFS= -DSYS_FREEBSD -DSYS_386BSD -DHAVE_TERMIOS AUTHDEFS= -DMD5 CLOCKDEFS= -DLOCAL_CLOCK -DPST -DWWVB -DAS2201 -DGOES -DGPSTM -DOMEGA \ - -DLEITCH + -DLEITCH -DTRAK CFLAGS+= ${NTPDEFS} ${DEFS_LOCAL} ${AUTHDEFS} ${CLOCKDEFS} ${COPTS} BINDIR?= /usr/sbin diff --git a/usr.sbin/xntpd/README.FreeBSD b/usr.sbin/xntpd/README.FreeBSD index 02a2cac761d9..2a7286ed894a 100644 --- a/usr.sbin/xntpd/README.FreeBSD +++ b/usr.sbin/xntpd/README.FreeBSD @@ -1,6 +1,6 @@ This version of NTP was converted to the BSD-style Makefile system by Garrett Wollman (wollman@freefall.cdrom.com); it is based on version -3.3z (late beta) from the University of Delaware. +3.3p (late beta) from the University of Delaware. Besides the Makefile changes, the DES code has been completely removed in order to make this code exportable. If you have a legal copy of diff --git a/usr.sbin/xntpd/lib/Makefile b/usr.sbin/xntpd/lib/Makefile index a109ee246f40..a58c52f35c32 100644 --- a/usr.sbin/xntpd/lib/Makefile +++ b/usr.sbin/xntpd/lib/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.3 1993/12/21 21:06:27 wollman Exp $ +# $Id: Makefile,v 1.4 1993/12/22 11:32:23 rgrimes Exp $ # CFLAGS+= -I${.CURDIR}/../include @@ -10,7 +10,7 @@ SRCS= atoint.c atolfp.c atouint.c auth12crypt.c authdecrypt.c authdes.c \ clocktime.c dofptoa.c dolfptoa.c emalloc.c fptoa.c fptoms.c \ gettstamp.c hextoint.c hextolfp.c humandate.c inttoa.c \ lib_strbuf.c mfptoa.c mfptoms.c modetoa.c mstolfp.c \ - msutotsf.c numtoa.c refnumtoa.c numtohost.c octtoint.c \ + msutotsf.c netof.c numtoa.c refnumtoa.c numtohost.c octtoint.c \ prettydate.c ranny.c tsftomsu.c tstotv.c tvtoa.c tvtots.c \ uglydate.c uinttoa.c utvtoa.c clocktypes.c \ md5.c a_md5encrypt.c a_md5decrypt.c \ diff --git a/usr.sbin/xntpd/ntpq/ntpq.c b/usr.sbin/xntpd/ntpq/ntpq.c index 5cfc3daff820..b956cc90e9c2 100644 --- a/usr.sbin/xntpd/ntpq/ntpq.c +++ b/usr.sbin/xntpd/ntpq/ntpq.c @@ -301,7 +301,7 @@ static int decodereach P((char *, U_LONG *)); static int decodearr P((char *, int *, l_fp *)); static char * getcode P((int, struct codestring *)); static void help P((struct parse *, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int helpsort P((const void *, const void *)); #else static int helpsort P((char **, char **)); @@ -335,7 +335,7 @@ static void output P((FILE *, char *, char *)); static void endoutput P((FILE *)); static void outputarr P((FILE *, char *, int, l_fp *)); static void cookedprint P((int, int, char *, int, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int assoccmp P((const void *, const void *)); #else static int assoccmp P((struct association *, struct association *)); @@ -1888,7 +1888,7 @@ help(pcmd, fp) for (xcp = opcmds; xcp->keyword != 0; xcp++) cmdsort[n++] = xcp->keyword; -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)cmdsort, n, sizeof(char *), helpsort); #else qsort((char *)cmdsort, n, sizeof(char *), helpsort); @@ -1934,7 +1934,7 @@ help(pcmd, fp) * helpsort - do hostname qsort comparisons */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) helpsort(t1, t2) const void *t1; const void *t2; @@ -3028,7 +3028,7 @@ void sortassoc() { if (numassoc > 1) -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)assoc_cache, numassoc, sizeof(struct association), assoccmp); #else @@ -3042,7 +3042,7 @@ sortassoc() * assoccmp - compare two associations */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) assoccmp(t1, t2) const void *t1; const void *t2; diff --git a/usr.sbin/xntpd/util/tickadj.c b/usr.sbin/xntpd/util/tickadj.c index ab10b3728a0e..b3b6ba9e93d7 100644 --- a/usr.sbin/xntpd/util/tickadj.c +++ b/usr.sbin/xntpd/util/tickadj.c @@ -1,4 +1,4 @@ -/* tickadj.c,v 3.1 1993/07/06 01:11:05 jbj Exp +/* * tickadj - read, and possibly modify, the kernel `tick' and * `tickadj' variables, as well as `dosynctodr'. Note that * this operates on the running kernel only. I'd like to be @@ -6,6 +6,41 @@ * mastered this yet. */ #include + +#ifdef SYS_LINUX +#include + +struct timex txc; + +int +main(int argc, char ** argv) +{ + if (argc > 2) + { + fprintf(stderr, "Usage: %s [tick_value]\n", argv[0]); + exit(-1); + } + else if (argc == 2) + { + if ( (txc.tick = atoi(argv[1])) < 1 ) + { + fprintf(stderr, "Silly value for tick: %s\n", argv[1]); + exit(-1); + } + txc.mode = ADJ_TICK; + } + else + txc.mode = 0; + + if (__adjtimex(&txc) < 0) + perror("adjtimex"); + else + printf("tick = %d\n", txc.tick); + + return(0); +} +#else /* not Linux... kmem tweaking: */ + #include #include #include @@ -353,6 +388,22 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) #endif #endif +#if defined(SYS_HPUX) +#define X_TICKADJ 0 +#define X_TICK 1 +#define X_DEF + static struct nlist nl[] = +#ifdef hp9000s300 + { {"_tickadj"}, + {"_old_tick"}, +#else + { {"tickadj"}, + {"old_tick"}, +#endif + {""}, + }; +#endif + #if !defined(X_DEF) #define X_TICKADJ 0 #define X_TICK 1 @@ -373,6 +424,7 @@ getoffsets(filex, tick_off, tickadj_off, dosync_off, noprintf_off) "/kernel/unix", "/386bsd", "/netbsd", + "/hp-ux", NULL }; struct stat stbuf; @@ -513,3 +565,4 @@ readvar(fd, off, var) exit(1); } } +#endif /* not Linux */ diff --git a/usr.sbin/xntpd/xntpd/Makefile b/usr.sbin/xntpd/xntpd/Makefile index 1f9c7471a667..b10d3764af6d 100644 --- a/usr.sbin/xntpd/xntpd/Makefile +++ b/usr.sbin/xntpd/xntpd/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.3 1993/12/23 10:21:55 rgrimes Exp $ +# $Id: Makefile,v 1.4 1994/02/03 23:23:17 wollman Exp $ # CFLAGS+= -I${.CURDIR}/../include @@ -34,7 +34,7 @@ SRCS= ntp_config.c ntp_control.c ntp_io.c ntp_leap.c \ refclock_wwvb.c refclock_goes.c refclock_mx4200.c \ refclock_parse.c refclock_as2201.c refclock_omega.c \ refclock_tpro.c refclock_leitch.c refclock_irig.c \ - refclock_msfees.c refclock_gpstm.c ntp_intres.c \ + refclock_msfees.c refclock_gpstm.c refclock_trak.c ntp_intres.c \ ntp_filegen.c version.c beforedepend: version.c diff --git a/usr.sbin/xntpd/xntpd/ntp_control.c b/usr.sbin/xntpd/xntpd/ntp_control.c index 1c7849f48820..77e21f528d5f 100644 --- a/usr.sbin/xntpd/xntpd/ntp_control.c +++ b/usr.sbin/xntpd/xntpd/ntp_control.c @@ -294,7 +294,7 @@ static struct utsname utsname; static u_char clocktypes[] = { CTL_SST_TS_NTP, /* REFCLK_NONE */ CTL_SST_TS_UNSPEC, /* REFCLK_LOCALCLOCK */ - CTL_SST_TS_HF, /* REFCLK_WWV_HEATH */ + CTL_SST_TS_HF, /* REFCLK_GPS_TRAK */ CTL_SST_TS_HF, /* REFCLK_WWV_PST */ CTL_SST_TS_LF, /* REFCLK_WWVB_SPECTRACOM */ CTL_SST_TS_UHF, /* REFCLK_GOES_TRUETIME */ diff --git a/usr.sbin/xntpd/xntpd/refclock_trak.c b/usr.sbin/xntpd/xntpd/refclock_trak.c index 39fb7d47b78c..b79bcbef5d3c 100644 --- a/usr.sbin/xntpd/xntpd/refclock_trak.c +++ b/usr.sbin/xntpd/xntpd/refclock_trak.c @@ -14,6 +14,8 @@ #include "ntp_refclock.h" #include "ntp_unixtime.h" +static void gps_send(); + #if defined(HAVE_BSD_TTYS) #include #endif /* HAVE_BSD_TTYS */ @@ -841,7 +843,7 @@ trak_poll(unit, peer) /* * usually trak_receive can get a timestamp every second */ -#ifndef TRAKPPS && TRAKCLK +#if !defined(TRAKPPS) && !defined(TRAKCLK) gettstamp(&gps->lastrec); #endif gps->polls++; diff --git a/usr.sbin/xntpd/xntpdc/ntpdc.c b/usr.sbin/xntpd/xntpdc/ntpdc.c index aae1b400aa1c..3113c9ff7817 100644 --- a/usr.sbin/xntpd/xntpdc/ntpdc.c +++ b/usr.sbin/xntpd/xntpdc/ntpdc.c @@ -53,7 +53,7 @@ static int findcmd P((char *, struct xcmd *, struct xcmd *, struct xcmd **)); static int getarg P((char *, int, arg_v *)); static int getnetnum P((char *, U_LONG *, char *)); static void help P((struct parse *, FILE *)); -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) static int helpsort P((const void *, const void *)); #else static int helpsort P((char **, char **)); @@ -1153,7 +1153,7 @@ help(pcmd, fp) for (xcp = opcmds; xcp->keyword != 0; xcp++) cmdsort[n++] = xcp->keyword; -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) qsort((void *)cmdsort, n, sizeof(char *), helpsort); #else qsort((char *)cmdsort, n, sizeof(char *), helpsort); @@ -1199,7 +1199,7 @@ help(pcmd, fp) * helpsort - do hostname qsort comparisons */ static int -#if defined(sgi) || defined(SYS_BSDI) +#if defined(sgi) || defined(SYS_BSDI) || defined(__STDC__) helpsort(t1, t2) const void *t1; const void *t2;