]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Many files:
authorHarlan Stenn <stenn@ntp.org>
Thu, 11 Nov 1999 09:43:36 +0000 (09:43 -0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 11 Nov 1999 09:43:36 +0000 (09:43 -0000)
  * configure.in:
  * ntpd/ntpd.c:
  DEC OSF cleanup (editorial comments by HMS)
  From: Tom Smith <smith@cag.lkg.dec.com>
  * ntpd/ntp_refclock.c: MAXUNIT bugfix
  From: Marc.Brett@westgeo.com
  * ntpd/ntp_refclock.c:
  * ntpd/ntpd.c:
  * ntpd/refclock_arc.c:
  * ntpd/refclock_as2201.c:
  * ntpd/refclock_atom.c:
  * ntpdc/ntpdc.c:
  * ntpq/ntpq.c:
  Code cleanup.
  From: Marc.Brett@westgeo.com
  * include/ntp_stdlib.h:
  * libntp/systime.c:
  * ntpd/ntp_proto.c:
  Replaced the 'sco5_oldclock' variable with 'systime_10ms_ticks'.
  Cleared libntp/systime.c and include/ntp_stdlib.h of references
  to SCO5_CLOCK and RELIANTUNIX_CLOCK (moved to ntpd/ntp_proto.c).
  From: Kamal A Mostafa <kamal@whence.com>

bk: 382a8fc8gSdRzzRQyA2Qq9Gt_JOv-w

ChangeLog
include/ntp_stdlib.h
libntp/systime.c
ntpd/ntp_proto.c
ntpd/ntp_refclock.c
ntpd/ntpd.c
ntpd/refclock_arc.c
ntpd/refclock_as2201.c
ntpd/refclock_atom.c
ntpdc/ntpdc.c
ntpq/ntpq.c

index 479a119247b0cc5ef2b2afcd7b7d95cc6d487f15..e3082203e82dc76afde5e8e3f0dd5f1998eddc62 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
 1999-11-11  Harlan Stenn  <stenn@whimsy.udel.edu>
 
+       * configure.in:
+       * ntpd/ntpd.c:
+       DEC OSF cleanup (editorial comments by HMS)
+       From: Tom Smith <smith@cag.lkg.dec.com> 
+       
+       * ntpd/ntp_refclock.c: MAXUNIT bugfix
+       From: Marc.Brett@westgeo.com
+       
+       * ntpd/ntp_refclock.c:
+       * ntpd/ntpd.c:
+       * ntpd/refclock_arc.c:
+       * ntpd/refclock_as2201.c:
+       * ntpd/refclock_atom.c:
+       * ntpdc/ntpdc.c:
+       * ntpq/ntpq.c:
+       Code cleanup.
+       From: Marc.Brett@westgeo.com
+
+       * include/ntp_stdlib.h:
+       * libntp/systime.c:
+       * ntpd/ntp_proto.c:
+       Replaced the 'sco5_oldclock' variable with 'systime_10ms_ticks'. 
+       Cleared libntp/systime.c and include/ntp_stdlib.h of references
+       to SCO5_CLOCK and RELIANTUNIX_CLOCK (moved to ntpd/ntp_proto.c). 
+       From: Kamal A Mostafa <kamal@whence.com>        
+
        * configure.in: alpha-dec-osf4* -> alpha*-dec-osf4*|alpha*-dec-osf5*
        From: Tom Smith <smith@cag.lkg.dec.com>
 
index 31dc72d63ced089ad0c493b09b7731982cf3b895..6a2a85221267b81e3e77651965819fe6d8b2e347 100644 (file)
@@ -164,9 +164,7 @@ extern HANDLE       hServDoneEvent;
 #endif
 
 /* systime.c */
-#if defined SCO5_CLOCK
-extern int     sco5_oldclock;          /* runtime detection of new clock */
-#endif /* SCO5_CLOCK */
+extern int     systime_10ms_ticks;     /* adj sysclock in 10ms increments */
 
 extern double  sys_maxfreq;            /* max frequency correction */
 
index 5f388f96748d7c08aa22e8583c33412fa4b77095..5e50fc52d6cd8ed137089af1d668301354519f1a 100644 (file)
@@ -31,9 +31,7 @@ extern DWORD units_per_tick;
 static long last_Adj = 0;
 #endif
 
-#if defined SCO5_CLOCK
-int sco5_oldclock;     /* runtime detection of new clock */
-#endif /* SCO5_CLOCK */
+int    systime_10ms_ticks = 0; /* adj sysclock in 10ms increments */
 
 #define MAXFREQ 500e-6
 
@@ -82,10 +80,7 @@ get_systime(
        (void) GETTIMEOFDAY(&tv, (struct timezone *)0);
        now->l_i = tv.tv_sec + JAN_1970;
 
-#if defined(SCO5_CLOCK) || defined(RELIANTUNIX_CLOCK)
-#if defined(SCO5_CLOCK)
-       if (sco5_oldclock == 1) {
-#endif /* SCO5_CLOCK */
+       if (systime_10ms_ticks) {
                /* fake better than 10ms resolution by interpolating 
                accumulated residual (in adj_systime(), see below) */
                dtemp = tv.tv_usec / 1e6;
@@ -97,12 +92,7 @@ get_systime(
                        }
                }
                dtemp *= FRAC;
-#if defined(SCO5_CLOCK)
-       }
-       else    /* HEY!!! Watch this "else" statement ... */
-#endif /* SCO5_CLOCK */
-#endif /* SCO5_CLOCK || RELIANTUNIX_CLOCK */
-       {       /* HEY!!! See that "else" statement up there??? */
+       } else {
                dtemp = tv.tv_usec * FRAC / 1e6;
        }
 
@@ -144,32 +134,21 @@ adj_systime(
                dtemp = -dtemp;
        }
 
-#if defined(SCO5_CLOCK) || defined(RELIANTUNIX_CLOCK)
-#if defined(SCO5_CLOCK)
-       if (sco5_oldclock == 1) {
-#endif /* SCO5_CLOCK */
+       if (systime_10ms_ticks) {
                /* accumulate changes until we have enough to adjust a tick */
                if (dtemp < 5000e-6) {
                        if (isneg) sys_residual = -dtemp;
                        else sys_residual = dtemp;
                        dtemp = 0;
-               }
-               else {
+               } else {
                        if (isneg) sys_residual = 10000e-6 - dtemp;
                        else sys_residual = dtemp - 10000e-6;
                        dtemp = 10000e-6;
                }
-#if defined(SCO5_CLOCK)
-       }
-       else {
+       } else {
                if (dtemp > sys_maxfreq)
                        dtemp = sys_maxfreq;
        }
-#endif /* SCO5_CLOCK */
-#else  /* SCO5_CLOCK || RELIANTUNIX_CLOCK */
-       if (dtemp > sys_maxfreq)
-               dtemp = sys_maxfreq;
-#endif /* SCO5_CLOCK */
 
 #ifdef SYS_WINNT
        dtemp = dtemp * 1000000.0;
index 13bea80cfd4fbb057cc50f5db8d6ce8572ff69ce..6d5429144b4780e4dadf84c68cc72c5d7f55d50d 100644 (file)
@@ -2037,17 +2037,18 @@ init_proto(void)
 #endif
        msyslog(LOG_DEBUG, "kern_enable is %d", kern_enable);
        stats_control = 1;
-#if defined SCO5_CLOCK
-       if ((int) sys_precision < -10) {
-               sco5_oldclock = 0;
-               msyslog(LOG_INFO, "new SCO clock detected");
-       }
-       else {
-               sco5_oldclock = 1;
-               msyslog(LOG_INFO, "old SCO clock; using ntp patches");
-       }
-#endif /* SCO5_CLOCK */
 
+       /*
+        * Some system clocks should only be adjusted in 10ms increments.
+        */
+#if defined RELIANTUNIX_CLOCK
+       systime_10ms_ticks = 1;                 /* Reliant UNIX */
+#elif defined SCO5_CLOCK
+       if (sys_precision >= (s_char)-10)       /* pre- SCO OpenServer 5.0.6 */
+               systime_10ms_ticks = 1;
+#endif
+       if (systime_10ms_ticks)
+               msyslog(LOG_INFO, "using 10ms tick adjustments");
 }
 
 
index 36e3a052331452df83015640d3549d2145d8020f..c7b9166973deb589c28ec2159e128b3747d92650 100644 (file)
@@ -208,7 +208,7 @@ refclock_newpeer(
        }
        clktype = (u_char)REFCLOCKTYPE(&peer->srcadr);
        unit = REFCLOCKUNIT(&peer->srcadr);
-       if (clktype >= num_refclock_conf || unit > MAXUNIT ||
+       if (clktype >= num_refclock_conf || unit >= MAXUNIT ||
                refclock_conf[clktype]->clock_start == noentry) {
                msyslog(LOG_ERR,
                        "refclock_newpeer: clock type %d invalid\n",
@@ -318,13 +318,11 @@ refclock_transmit(
        struct peer *peer       /* peer structure pointer */
        )
 {
-       struct refclockproc *pp;
        u_char clktype;
        int unit;
        int hpoll;
        u_long next;
 
-       pp = peer->procptr;
        clktype = peer->refclktype;
        unit = peer->refclkunit;
        peer->sent++;
@@ -1189,7 +1187,7 @@ refclock_control(
                return;
        clktype = (u_char)REFCLOCKTYPE(srcadr);
        unit = REFCLOCKUNIT(srcadr);
-       if (clktype >= num_refclock_conf || unit > MAXUNIT)
+       if (clktype >= num_refclock_conf || unit >= MAXUNIT)
                return;
        if (!(peer = typeunit[clktype][unit]))
                return;
@@ -1289,7 +1287,7 @@ refclock_buginfo(
                return;
        clktype = (u_char) REFCLOCKTYPE(srcadr);
        unit = REFCLOCKUNIT(srcadr);
-       if (clktype >= num_refclock_conf || unit > MAXUNIT)
+       if (clktype >= num_refclock_conf || unit >= MAXUNIT)
                return;
        if (!(peer = typeunit[clktype][unit]))
                return;
index f805c1b96b307f243f7f5841288ecae0e794c945..923b1f7026530d6c449520bf64450756a5579cfc 100644 (file)
@@ -909,7 +909,8 @@ service_main(
                 */
        }
 # endif /* HAVE_IO_COMPLETION_PORT */
-       exit(0);
+       exit(1); /* unreachable */
+       return 1;               /* DEC OSF cc braindamage */
 }
 
 
index c511260783c985d427404e66d3a8ba6789a36eb5..1db8a9a512410a600bd44c52b77f61be013d0944 100644 (file)
@@ -779,7 +779,7 @@ arc_receive(
        struct peer *peer;
        char c;
        int i, n, wday, month, bst, status;
-       int last_offset;
+       int arc_last_offset;
 
        /*
         * Initialize pointers and read the timecode and timestamp
@@ -801,7 +801,7 @@ arc_receive(
        }
 
        /*
-         The `last_offset' is the offset in lastcode[] of the last byte
+         The `arc_last_offset' is the offset in lastcode[] of the last byte
          received, and which we assume actually received the input
          timestamp.
 
@@ -810,7 +810,7 @@ arc_receive(
          trailing \r, and that that \r will be timestamped.  But this
          assumption also works if receive the characters one-by-one.)
        */
-       last_offset = pp->lencode+rbufp->recv_length - 1;
+       arc_last_offset = pp->lencode+rbufp->recv_length - 1;
 
        /*
          We catch a timestamp iff:
@@ -837,7 +837,7 @@ arc_receive(
           (pp->lencode == 1) &&
 #endif
           ((pp->lencode != 1) || (c != '\r')) &&
-          (last_offset >= 1)) {
+          (arc_last_offset >= 1)) {
                /* Note that the timestamp should be corrected if >1 char rcvd. */
                l_fp timestamp;
                timestamp = rbufp->recv_time;
@@ -858,11 +858,11 @@ arc_receive(
                  allow for the trailing \r, normally not used but a good
                  handle for tty_clk or somesuch kernel timestamper.
                */
-               if(last_offset > LENARC) {
+               if(arc_last_offset > LENARC) {
 #ifdef ARCRON_DEBUG
                        if(debug) {
                                printf("arc: input code too long (%d cf %d); rejected.\n",
-                                      last_offset, LENARC);
+                                      arc_last_offset, LENARC);
                        }
 #endif
                        pp->lencode = 0;
@@ -870,16 +870,16 @@ arc_receive(
                        return;
                }
 
-               L_SUBUF(&timestamp, charoffsets[last_offset]);
+               L_SUBUF(&timestamp, charoffsets[arc_last_offset]);
 #ifdef ARCRON_DEBUG
                if(debug > 1) {
                        printf(
                                "arc: %s%d char(s) rcvd, the last for lastcode[%d]; -%sms offset applied.\n",
                                ((rbufp->recv_length > 1) ? "*** " : ""),
                                rbufp->recv_length,
-                               last_offset,
+                               arc_last_offset,
                                mfptoms((unsigned long)0,
-                                       charoffsets[last_offset],
+                                       charoffsets[arc_last_offset],
                                        1));
                }
 #endif
index 7c3d043d5e0adea77936b9d32d05e97539dd6633..2c104402f098cf10dd6f34222472476c1a66aee8 100644 (file)
@@ -358,7 +358,6 @@ as2201_poll(
        struct peer *peer
        )
 {
-       register struct as2201unit *up;
        struct refclockproc *pp;
 
        /*
@@ -367,7 +366,6 @@ as2201_poll(
         * eavesdropper watching the radio.
         */
        pp = peer->procptr;
-       up = (struct as2201unit *)pp->unitptr;
        if (write(pp->io.fd, "\r*toc\r", 6) != 6) {
                refclock_report(peer, CEVNT_FAULT);
        } else {
index 1a3dea5c5fb2d056bd62688a67ad990963378415..63e17c1f6c04e8738a511f167e947b38fb3c42eb 100644 (file)
@@ -433,7 +433,9 @@ atom_poll(
        struct peer *peer
        )
 {
+#if defined(PPS) || defined(HAVE_PPSAPI)
        register struct atomunit *up;
+#endif /* PPS || HAVE_PPSAPI */
        struct refclockproc *pp;
 
        /*
@@ -442,8 +444,8 @@ atom_poll(
         * samples.
         */
        pp = peer->procptr;
-       up = (struct atomunit *)pp->unitptr;
 #if defined(PPS) || defined(HAVE_PPSAPI)
+       up = (struct atomunit *)pp->unitptr;
        if (!(up->flags & !(FLAG_AUX | FLAG_TTY))) {
                int err;
 
index 0aa1edfd6232ebb08daede1439bd0359ab2bb4bf..a5299548f7ac7584ca9c177e19fa98b4c822ac30 100644 (file)
@@ -1206,14 +1206,14 @@ getarg(
  */
 static int
 getnetnum(
-       const char *host,
+       const char *hname,
        u_int32 *num,
        char *fullhost
        )
 {
        struct hostent *hp;
 
-       if (decodenetnum(host, num)) {
+       if (decodenetnum(hname, num)) {
                if (fullhost != 0) {
                        (void) sprintf(fullhost,
                                       "%u.%u.%u.%u", (u_int)((htonl(*num)>>24)&0xff),
@@ -1221,13 +1221,13 @@ getnetnum(
                                       (u_int)(htonl(*num)&0xff));
                }
                return 1;
-       } else if ((hp = gethostbyname(host)) != 0) {
+       } else if ((hp = gethostbyname(hname)) != 0) {
                memmove((char *)num, hp->h_addr, sizeof(u_int32));
                if (fullhost != 0)
                    (void) strcpy(fullhost, hp->h_name);
                return 1;
        } else {
-               (void) fprintf(stderr, "***Can't find host %s\n", host);
+               (void) fprintf(stderr, "***Can't find host %s\n", hname);
                return 0;
        }
        /*NOTREACHED*/
@@ -1661,7 +1661,7 @@ error(
  */
 static u_long
 getkeyid(
-       const char *prompt
+       const char *keyprompt
        )
 {
        register char *p;
@@ -1677,7 +1677,7 @@ getkeyid(
                fi = stdin;
            else
                setbuf(fi, (char *)NULL);
-       fprintf(stderr, "%s", prompt); fflush(stderr);
+       fprintf(stderr, "%s", keyprompt); fflush(stderr);
        for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
                if (p < &pbuf[18])
                    *p++ = c;
index dcce6e3535c99370a18e6615d6d6447be40a8737..3361e2bc1fd7d74cfa854a383efb9526ed1a93c3 100644 (file)
@@ -1565,14 +1565,14 @@ getarg(
  */
 int
 getnetnum(
-       const char *host,
+       const char *hname,
        u_int32 *num,
        char *fullhost
        )
 {
        struct hostent *hp;
 
-       if (decodenetnum(host, num)) {
+       if (decodenetnum(hname, num)) {
                if (fullhost != 0) {
                        (void) sprintf(fullhost, "%lu.%lu.%lu.%lu",
                                       (u_long)((htonl(*num) >> 24) & 0xff),
@@ -1581,13 +1581,13 @@ getnetnum(
                                       (u_long)(htonl(*num) & 0xff));
                }
                return 1;
-       } else if ((hp = gethostbyname(host)) != 0) {
+       } else if ((hp = gethostbyname(hname)) != 0) {
                memmove((char *)num, hp->h_addr, sizeof(u_int32));
                if (fullhost != 0)
                    (void) strcpy(fullhost, hp->h_name);
                return 1;
        } else {
-               (void) fprintf(stderr, "***Can't find host %s\n", host);
+               (void) fprintf(stderr, "***Can't find host %s\n", hname);
                return 0;
        }
        /*NOTREACHED*/
@@ -2373,7 +2373,7 @@ error(
  */
 static u_long
 getkeyid(
-       const char *prompt
+       const char *keyprompt
        )
 {
        register char *p;
@@ -2389,7 +2389,7 @@ getkeyid(
                fi = stdin;
            else
                setbuf(fi, (char *)NULL);
-       fprintf(stderr, "%s", prompt); fflush(stderr);
+       fprintf(stderr, "%s", keyprompt); fflush(stderr);
        for (p=pbuf; (c = getc(fi))!='\n' && c!=EOF;) {
                if (p < &pbuf[18])
                    *p++ = c;