and SHM (28).
Correct Windows port's refclock_open() to return 0 on failure not -1.
Correct CHU, dumbclock, and WWVB drivers to check for 0 returned from
refclock_open() on failure.
Correct "SIMUL=4 ./flock-build -1" to prioritize -1/--one.
bk: 4b79d677nCM0cZM7QfOXPN2qtirktA
+---
+
+* [Bug 1464] synchronization source wrong for refclocks ARCRON_MSF (27)
+ and SHM (28).
+* Correct Windows port's refclock_open() to return 0 on failure not -1.
+* Correct CHU, dumbclock, and WWVB drivers to check for 0 returned from
+ refclock_open() on failure.
+* Correct "SIMUL=4 ./flock-build -1" to prioritize -1/--one.
+
---
(4.2.6p1-RC5) 2010/02/09 Released by Harlan Stenn <stenn@ntp.org>
#PARSE=
STD="--enable-simulator"
-case "$SIMUL" in
- '') PARALLEL_BUILDS=1
- ;;
- *) PARALLEL_BUILDS=$SIMUL
+case "$SIMUL::$FB_FIRSTONLY" in
+ ::*)
+ PARALLEL_BUILDS=1
+ ;;
+ *::0)
+ PARALLEL_BUILDS=$SIMUL
+ ;;
+ *)
+ PARALLEL_BUILDS=1
esac
case "$PARALLEL_BUILDS" in
[ -f .buildkey-$i ] && SKIPTHIS=1
case "$SKIPTHIS" in
1)
- echo flock-build running on $i? check LIST, skipping
- ;;
- 0)
- echo $i
- echo $SIG > .buildkey-$i
- case "1" in
- 0)
- ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
- ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
- ssh $i "cd $c_d ; ./build $SIG $STD --disable-all-clocks $BUILD_ARGS" &
- ;;
- 1)
- cat > .flockbuild-$i-$SIG <<-ENDQUOT
+ echo flock-build running on $i? check LIST, skipping
+ ;;
+ 0)
+ echo $i
+ echo $SIG > .buildkey-$i
+ case "1" in
+ 0)
+ ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
+ ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
+ ssh $i "cd $c_d ; ./build $SIG $STD --disable-all-clocks $BUILD_ARGS" &
+ ;;
+ 1)
+ cat > .flockbuild-$i-$SIG <<-ENDQUOT
#!/bin/sh
# script uses job control and expects to be invoked
echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
rm .buildkey-$i
ENDQUOT
- chmod +x .flockbuild-$i-$SIG
- ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
- rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
- esac
+ chmod +x .flockbuild-$i-$SIG
+ ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
+ rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
+ esac
esac
done
echo `date -u '+%H:%M:%S'` flock-build launched
CTL_SST_TS_NTP, /* not used (24) */
CTL_SST_TS_NTP, /* not used (25) */
CTL_SST_TS_UHF, /* REFCLK_GPS_HP (26) */
- CTL_SST_TS_TELEPHONE, /* REFCLK_ARCRON_MSF (27) */
- CTL_SST_TS_TELEPHONE, /* REFCLK_SHM (28) */
+ CTL_SST_TS_LF, /* REFCLK_ARCRON_MSF (27) */
+ CTL_SST_TS_UHF, /* REFCLK_SHM (28) */
CTL_SST_TS_UHF, /* REFCLK_PALISADE (29) */
CTL_SST_TS_UHF, /* REFCLK_ONCORE (30) */
CTL_SST_TS_UHF, /* REFCLK_JUPITER (31) */
#include "ntp_tty.h"
#include "ntp_refclock.h"
#include "ntp_stdlib.h"
+#include "ntp_assert.h"
#include <stdio.h>
msyslog(LOG_ERR, "refclock_open %s: %m", dev);
return (0);
}
+ NTP_INSIST(fd != 0);
if (!refclock_setup(fd, speed, lflags)) {
close(fd);
return (0);
return (fd);
}
+
/*
* refclock_setup - initialize terminal interface structure
*/
/*
* Convert to signed fraction offset and stuff in median filter.
*/
- pp->lastrec.l_ui = ap->ts.tv_sec + JAN_1970;
+ pp->lastrec.l_ui = (u_int32)ap->ts.tv_sec + JAN_1970;
dtemp = ap->ts.tv_nsec / 1e9;
pp->lastrec.l_uf = (u_int32)(dtemp * FRAC);
if (dtemp > .5)
snprintf(device, sizeof(device), DEVICE, unit);
fd = refclock_open(device, SPEED232, LDISC_RAW);
#endif /* HAVE_AUDIO */
- if (fd < 0)
+ if (fd <= 0)
return (0);
/*
printf ("starting Dumbclock with device %s\n",device);
#endif
fd = refclock_open(device, SPEED232, 0);
- if (fd < 0)
+ if (!fd)
return (0);
/*
* Open serial port. Use CLK line discipline, if available.
*/
snprintf(device, sizeof(device), DEVICE, unit);
- if (-1 == (fd = refclock_open(device, SPEED232, LDISC_CLK)))
+ if (0 == (fd = refclock_open(device, SPEED232, LDISC_CLK)))
return (0);
/*
#include "ntp_machine.h"
#include "ntp_stdlib.h"
#include "ntp_syslog.h"
+#include "ntp_assert.h"
#include "ntp_debug.h"
#include "ntp_fp.h"
#include "ntp.h"
* refclock_open - open serial port for reference clock
*
* This routine opens a serial port for I/O and sets default options. It
- * returns the file descriptor or -1 indicating failure.
+ * returns the file descriptor or 0 indicating failure.
*/
int refclock_open(
char * dev, /* device name pointer */
HANDLE h;
COMMTIMEOUTS timeouts;
DCB dcb;
+ int fd;
/*
* open communication port handle
if (INVALID_HANDLE_VALUE == h) {
msyslog(LOG_ERR, "Device %s CreateFile error: %m", windev);
- return -1;
+ return 0;
}
/* Change the input/output buffers to be large. */
if (!SetupComm(h, 1024, 1024)) {
msyslog(LOG_ERR, "Device %s SetupComm error: %m", windev);
- return -1;
+ return 0;
}
dcb.DCBlength = sizeof(dcb);
if (!GetCommState(h, &dcb)) {
msyslog(LOG_ERR, "Device %s GetCommState error: %m",
windev);
- return -1;
+ return 0;
}
switch (speed) {
default:
msyslog(LOG_ERR, "Device %s unsupported baud rate "
"code %u", windev, speed);
- return -1;
+ return 0;
}
if (!SetCommState(h, &dcb)) {
msyslog(LOG_ERR, "Device %s SetCommState error: %m", windev);
- return -1;
+ return 0;
}
/* watch out for CR (dcb.EvtChar) as well as the CD line */
if (!SetCommMask(h, EV_RXFLAG | EV_RLSD)) {
msyslog(LOG_ERR, "Device %s SetCommMask error: %m", windev);
- return -1;
+ return 0;
}
/* configure the handle to never block */
if (!SetCommTimeouts(h, &timeouts)) {
msyslog(LOG_ERR, "Device %s SetCommTimeouts error: %m", windev);
- return -1;
+ return 0;
}
- return (int)_open_osfhandle((int)h, _O_TEXT);
+ fd = _open_osfhandle((int)h, _O_TEXT);
+ if (fd < 0)
+ return 0;
+ NTP_INSIST(fd != 0);
+ return fd;
}