From: Harlan Stenn Date: Wed, 20 Oct 1999 06:40:01 +0000 (-0000) Subject: Many files: X-Git-Tag: NTP_4_98_c~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e34cb335eadb190005537d55e19a74ccdbd1ae8a;p=thirdparty%2Fntp.git Many files: * ntpd/refclock_atom.c: AIOCTIMESTAMP patch * ntpd/ntpd.c: SCO clock patch * ntpd/ntp_request.c: noselect patch * ntpd/ntp_refclock.c: AIOCTIMESTAMP patch * ntpd/ntp_proto.c: noselect patch * ntpd/ntp_intres.c: noselect patch * ntpd/ntp_config.c: noselect patch * include/ntp_request.h: noselect patch * include/ntp.h: noselect patch From: Kamal A Mostafa * configure.in: * acconfig.h: TTYCLK_AIOCTIMESTAMP Stuff for Kamal * ntpd/refclock_atom.c (atom_pps): make "result" initialization uglier, but more bulletproof. bk: 380d63c1_xRDVw2dc2DNTGnlTkUrww --- diff --git a/ChangeLog b/ChangeLog index fe02b7f545..f5c486ae59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 1999-10-20 Harlan Stenn + * ntpd/refclock_atom.c: AIOCTIMESTAMP patch + * ntpd/ntpd.c: SCO clock patch + * ntpd/ntp_request.c: noselect patch + * ntpd/ntp_refclock.c: AIOCTIMESTAMP patch + * ntpd/ntp_proto.c: noselect patch + * ntpd/ntp_intres.c: noselect patch + * ntpd/ntp_config.c: noselect patch + * include/ntp_request.h: noselect patch + * include/ntp.h: noselect patch + From: Kamal A Mostafa + + * configure.in: + * acconfig.h: TTYCLK_AIOCTIMESTAMP + Stuff for Kamal + + * ntpd/refclock_atom.c (atom_pps): make "result" initialization + uglier, but more bulletproof. + * configure.in (sys/timepps.h): Fixed. From: John Hay diff --git a/acconfig.h b/acconfig.h index 5790e1e39d..da7387e3fb 100644 --- a/acconfig.h +++ b/acconfig.h @@ -271,6 +271,9 @@ /* do we have the tty_clk line discipline/streams module? */ #undef TTYCLK +/* What about TTYCLK_AIOCTIMESTAMP? */ +#undef TTYCLK_AIOCTIMESTAMP + /* does the kernel support precision time discipline? */ #undef KERNEL_PLL diff --git a/configure.in b/configure.in index 945a40da71..300ed39be3 100644 --- a/configure.in +++ b/configure.in @@ -1213,6 +1213,20 @@ case "$ac_cv_var_tty_clk" in yes) AC_DEFINE(TTYCLK) ;; esac +AC_CACHE_CHECK(for AIOCTIMESTAMPCTL, ac_cv_var_aioctimestamp, + AC_EGREP_CPP(yes, + [#include +#ifdef AIOCTIMESTAMPCTL + yes +#endif + ], ac_cv_var_aioctimestamp=yes, ac_cv_var_aioctimestamp=no)) +case "$ac_cv_var_aioctimestamp" in + yes) + AC_DEFINE(TTYCLK_AIOCTIMESTAMP) + AC_DEFINE(TTYCLK) + ;; +esac + AC_CACHE_CHECK(for the ppsclock streams module, ac_cv_var_ppsclock, ac_cv_var_ppsclock=$ac_cv_struct_ppsclockev) diff --git a/include/ntp.h b/include/ntp.h index f579a7d146..790e0a5e0a 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -320,6 +320,7 @@ struct peer { #define FLAG_PREFER 0x80 /* this is the preferred peer */ #define FLAG_BURST 0x100 /* burst mode */ #define FLAG_SKEY 0x200 /* autokey authentication */ +#define FLAG_NOSELECT 0x400 /* this is a "noselect" peer */ /* * Definitions for the clear() routine. We use memset() to clear diff --git a/include/ntp_request.h b/include/ntp_request.h index 574d25823c..87dba88154 100644 --- a/include/ntp_request.h +++ b/include/ntp_request.h @@ -530,6 +530,7 @@ struct conf_peer { #define CONF_FLAG_AUTHENABLE 0x1 #define CONF_FLAG_PREFER 0x2 #define CONF_FLAG_BURST 0x4 +#define CONF_FLAG_NOSELECT 0x8 #define CONF_FLAG_SKEY 0x10 /* diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 16494ab765..e21f5b002e 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -138,6 +138,7 @@ extern HANDLE ResolverThreadHandle; #define CONF_MOD_SKEY 7 #define CONF_MOD_TTL 8 #define CONF_MOD_MODE 9 +#define CONF_MOD_NOSELECT 10 #define CONF_RES_MASK 1 #define CONF_RES_IGNORE 2 @@ -230,6 +231,7 @@ static struct keyword mod_keywords[] = { { "minpoll", CONF_MOD_MINPOLL }, { "maxpoll", CONF_MOD_MAXPOLL }, { "prefer", CONF_MOD_PREFER }, + { "noselect", CONF_MOD_NOSELECT }, { "burst", CONF_MOD_BURST }, { "autokey", CONF_MOD_SKEY }, { "mode", CONF_MOD_MODE }, /* reference clocks */ @@ -1013,6 +1015,10 @@ getconfig( peerflags |= FLAG_PREFER; break; + case CONF_MOD_NOSELECT: + peerflags |= FLAG_NOSELECT; + break; + case CONF_MOD_BURST: peerflags |= FLAG_BURST; break; diff --git a/ntpd/ntp_intres.c b/ntpd/ntp_intres.c index 96e111c658..e6fa6364d2 100644 --- a/ntpd/ntp_intres.c +++ b/ntpd/ntp_intres.c @@ -869,7 +869,7 @@ readconf( } if ((intval[TOK_FLAGS] & ~(FLAG_AUTHENABLE | FLAG_PREFER | - FLAG_BURST | FLAG_SKEY)) + FLAG_NOSELECT | FLAG_BURST | FLAG_SKEY)) != 0) { msyslog(LOG_ERR, "invalid flags (%ld) in file %s", intval[TOK_FLAGS], name); @@ -881,6 +881,8 @@ readconf( flags |= CONF_FLAG_AUTHENABLE; if (intval[TOK_FLAGS] & FLAG_PREFER) flags |= CONF_FLAG_PREFER; + if (intval[TOK_FLAGS] & FLAG_NOSELECT) + flags |= CONF_FLAG_NOSELECT; if (intval[TOK_FLAGS] & FLAG_BURST) flags |= CONF_FLAG_BURST; if (intval[TOK_FLAGS] & FLAG_SKEY) diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index d691b27e25..0e776c9b89 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -1232,6 +1232,8 @@ clock_select(void) for (peer = peer_hash[n]; peer != 0; peer = peer->next) { peer->flags &= ~FLAG_SYSPEER; peer->status = CTL_PST_SEL_REJECT; + if (peer->flags & FLAG_NOSELECT) + continue; /* noselect (survey only) */ if (peer->reach == 0) continue; /* unreachable */ if (peer->stratum > 1 && peer->refid == diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index 8ddb4c35c4..6c3fda5fe6 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -25,7 +25,12 @@ #endif #ifdef TTYCLK -#include +#ifdef TTYCLK_AIOCTIMESTAMP +# include +# define TIOCDCDTIMESTAMP AIOCTIMESTAMPTV +#else +# include +#endif #endif /* TTYCLK */ #ifdef HAVE_PPSCLOCK_H @@ -827,7 +832,7 @@ refclock_open( ttyp->c_lflag = 0; ttyp->c_cc[VMIN] = 1; } -#ifdef TIOCMGET +#if defined(TIOCMGET) && !defined(TTYCLK_AIOCTIMESTAMP) /* * If we have modem control, check to see if modem leads are * active; if so, set remote connection. This is necessary for @@ -1012,7 +1017,7 @@ refclock_ioctl( #endif /* TTYCLK */ #ifdef STREAM -#ifdef TTYCLK +#if defined(TTYCLK) && !defined(TTYCLK_AIOCTIMESTAMP) /* * The TTYCLK option provides timestamping at the driver level. * It requires the tty_clk streams module and System V STREAMS @@ -1041,7 +1046,17 @@ refclock_ioctl( fd, rval, str); } } -#endif /* TTYCLK */ +#endif /* TTYCLK and !TTYCLK_AIOCTIMESTAMP */ + +#ifdef TTYCLK_AIOCTIMESTAMP + /* + * The TTYCLK_AIOCTIMESTAMP option provides timestamping at the + * driver level. It requires the AIOCTIMESTAMPCTL and AIOCTIMESTAMPTV + * ioctls. + */ + if (ioctl(fd, AIOCTIMESTAMPCTL, 1) < 0) + msyslog(LOG_ERR, "refclock_ioctl: AIOCTIMESTAMPCTL failed: %m"); +#endif #ifdef PPS /* diff --git a/ntpd/ntp_request.c b/ntpd/ntp_request.c index 6e542ff4e7..3743118f3e 100644 --- a/ntpd/ntp_request.c +++ b/ntpd/ntp_request.c @@ -1137,7 +1137,7 @@ do_conf( && cp->hmode != MODE_BROADCAST) fl = 1; if (cp->flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER - | CONF_FLAG_BURST | CONF_FLAG_SKEY)) + | CONF_FLAG_NOSELECT | CONF_FLAG_BURST | CONF_FLAG_SKEY)) fl = 1; cp++; } @@ -1174,6 +1174,8 @@ do_conf( fl |= FLAG_AUTHENABLE; if (cp->flags & CONF_FLAG_PREFER) fl |= FLAG_PREFER; + if (cp->flags & CONF_FLAG_NOSELECT) + fl |= FLAG_NOSELECT; if (cp->flags & CONF_FLAG_BURST) fl |= FLAG_BURST; if (cp->flags & CONF_FLAG_SKEY) diff --git a/ntpd/ntpd.c b/ntpd/ntpd.c index 0aedaba3e7..5d53527fbb 100644 --- a/ntpd/ntpd.c +++ b/ntpd/ntpd.c @@ -88,6 +88,11 @@ #ifdef _AIX #include #endif /* _AIX */ + +#ifdef SCO5_CLOCK +#include +#endif + /* * Signals we catch for debugging. If not debugging we ignore them. */ @@ -560,6 +565,26 @@ service_main( */ #endif /* SYS_WINNT */ +#ifdef SCO5_CLOCK + /* + * SCO OpenServer's system clock offers much more precise timekeeping + * on the base CPU than the other CPUs (for multiprocessor systems), + * so we must lock to the base CPU. + */ + { + int fd = open("/dev/at1", O_RDONLY); + if (fd >= 0) { + int zero = 0; + if (ioctl(fd, ACPU_LOCK, &zero) < 0) + msyslog(LOG_ERR, "cannot lock to base CPU: %m\n"); + close( fd ); + } /* else ... + * If we can't open the device, this probably just isn't + * a multiprocessor system, so we're A-OK. + */ + } +#endif + #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE) /* * lock the process into memory @@ -661,6 +686,7 @@ service_main( #ifdef REFCLOCK init_refclock(); #endif + set_process_priority(); init_proto(); init_io(); init_loopfilter(); @@ -675,8 +701,6 @@ service_main( */ getconfig(argc, argv); - set_process_priority(); - initializing = 0; #if defined(SYS_WINNT) && !defined(NODETACH) diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index bf61a50e6b..deb718034e 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -179,7 +179,13 @@ atom_start( */ if (fdpps <= 0) { (void)sprintf(device, DEVICE, unit); - if ((fd = refclock_open(device, SPEED232, LDISC_CLKPPS)) != 0) + if ((fd = refclock_open(device, SPEED232, +#ifdef TTYCLK_AIOCTIMESTAMP + LDISC_RAW +#else + LDISC_CLKPPS +#endif + )) != 0) flags |= FLAG_TTY; } #endif /* TTYCLK */ @@ -269,12 +275,14 @@ atom_pps( double doffset; int i; #if !defined(HAVE_PPSAPI) -#ifdef HAVE_CIOGETEV - int request = CIOGETEV; -#endif -#ifdef HAVE_TIOCGPPSEV - int request = TIOCGPPSEV; -#endif + int request = +# ifdef HAVE_CIOGETEV + CIOGETEV +# endif +# ifdef HAVE_TIOCGPPSEV + TIOCGPPSEV +# endif + ; #endif /* HAVE_PPSAPI */ /*