From: Harlan Stenn Date: Thu, 11 Nov 1999 09:43:36 +0000 (-0000) Subject: Many files: X-Git-Tag: NTP_4_0_98_F~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a88ed1f8719bfa001c2220ba732dcaa4cff63b33;p=thirdparty%2Fntp.git Many files: * configure.in: * ntpd/ntpd.c: DEC OSF cleanup (editorial comments by HMS) From: Tom Smith * 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 bk: 382a8fc8gSdRzzRQyA2Qq9Gt_JOv-w --- diff --git a/ChangeLog b/ChangeLog index 479a119247..e3082203e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,31 @@ 1999-11-11 Harlan Stenn + * configure.in: + * ntpd/ntpd.c: + DEC OSF cleanup (editorial comments by HMS) + From: Tom Smith + + * 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 + * configure.in: alpha-dec-osf4* -> alpha*-dec-osf4*|alpha*-dec-osf5* From: Tom Smith diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h index 31dc72d63c..6a2a852212 100644 --- a/include/ntp_stdlib.h +++ b/include/ntp_stdlib.h @@ -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 */ diff --git a/libntp/systime.c b/libntp/systime.c index 5f388f9674..5e50fc52d6 100644 --- a/libntp/systime.c +++ b/libntp/systime.c @@ -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; diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index 13bea80cfd..6d5429144b 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -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"); } diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index 36e3a05233..c7b9166973 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -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; diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index f805c1b96b..923b1f7026 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -909,7 +909,8 @@ service_main( */ } # endif /* HAVE_IO_COMPLETION_PORT */ - exit(0); + exit(1); /* unreachable */ + return 1; /* DEC OSF cc braindamage */ } diff --git a/ntpd/refclock_arc.c b/ntpd/refclock_arc.c index c511260783..1db8a9a512 100644 --- a/ntpd/refclock_arc.c +++ b/ntpd/refclock_arc.c @@ -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(×tamp, charoffsets[last_offset]); + L_SUBUF(×tamp, 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 diff --git a/ntpd/refclock_as2201.c b/ntpd/refclock_as2201.c index 7c3d043d5e..2c104402f0 100644 --- a/ntpd/refclock_as2201.c +++ b/ntpd/refclock_as2201.c @@ -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 { diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index 1a3dea5c5f..63e17c1f6c 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -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; diff --git a/ntpdc/ntpdc.c b/ntpdc/ntpdc.c index 0aa1edfd62..a5299548f7 100644 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@ -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; diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c index dcce6e3535..3361e2bc1f 100644 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@ -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;