1999-10-20 Harlan Stenn <stenn@whimsy.udel.edu>
+ * 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 <kamal@whence.com>
+
+ * 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 <jhay@mikom.csir.co.za>
/* 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
yes) AC_DEFINE(TTYCLK) ;;
esac
+AC_CACHE_CHECK(for AIOCTIMESTAMPCTL, ac_cv_var_aioctimestamp,
+ AC_EGREP_CPP(yes,
+ [#include <sys/sio.h>
+#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)
#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
#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
/*
#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
{ "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 */
peerflags |= FLAG_PREFER;
break;
+ case CONF_MOD_NOSELECT:
+ peerflags |= FLAG_NOSELECT;
+ break;
+
case CONF_MOD_BURST:
peerflags |= FLAG_BURST;
break;
}
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);
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)
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 ==
#endif
#ifdef TTYCLK
-#include <sys/clkdefs.h>
+#ifdef TTYCLK_AIOCTIMESTAMP
+# include <sys/sio.h>
+# define TIOCDCDTIMESTAMP AIOCTIMESTAMPTV
+#else
+# include <sys/clkdefs.h>
+#endif
#endif /* TTYCLK */
#ifdef HAVE_PPSCLOCK_H
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
#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
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
/*
&& 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++;
}
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)
#ifdef _AIX
#include <ulimit.h>
#endif /* _AIX */
+
+#ifdef SCO5_CLOCK
+#include <sys/ci/ciioctl.h>
+#endif
+
/*
* Signals we catch for debugging. If not debugging we ignore them.
*/
*/
#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
#ifdef REFCLOCK
init_refclock();
#endif
+ set_process_priority();
init_proto();
init_io();
init_loopfilter();
*/
getconfig(argc, argv);
- set_process_priority();
-
initializing = 0;
#if defined(SYS_WINNT) && !defined(NODETACH)
*/
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 */
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 */
/*