]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1464] synchronization source wrong for refclocks ARCRON_MSF (27)
authorDave Hart <hart@ntp.org>
Mon, 15 Feb 2010 23:19:19 +0000 (23:19 +0000)
committerDave Hart <hart@ntp.org>
Mon, 15 Feb 2010 23:19:19 +0000 (23:19 +0000)
  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

ChangeLog
flock-build
ntpd/ntp_control.c
ntpd/ntp_refclock.c
ntpd/refclock_chu.c
ntpd/refclock_dumbclock.c
ntpd/refclock_wwvb.c
ports/winnt/ntpd/win32_io.c

index 8fe00f113c4334b3381d44b52463220aaef796b9..27cd1d595068dccf647b51d2542bbc4b38264988 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+---
+
+* [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>
 
index dbdf990a4d695a5f21e5107c1733eae64189794e..1756cc4a05188495c4313ba95651da79dc162e9d 100755 (executable)
@@ -18,10 +18,15 @@ PARSE="--enable-parse-clocks"
 #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
@@ -63,19 +68,19 @@ do
     [ -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
@@ -114,10 +119,10 @@ do
                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
index 9ab9d1c5e94952957b4b44727efa2029c37b3cbe..7ffeacb5a30dec529bc177a40cca1c2d0a6d1a9b 100644 (file)
@@ -401,8 +401,8 @@ static u_char clocktypes[] = {
        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) */
index 8275294333471e662a1d2183e85b4448f2f47819..d299903a8badb80c6de676e543daede50f223db2 100644 (file)
@@ -11,6 +11,7 @@
 #include "ntp_tty.h"
 #include "ntp_refclock.h"
 #include "ntp_stdlib.h"
+#include "ntp_assert.h"
 
 #include <stdio.h>
 
@@ -758,6 +759,7 @@ refclock_open(
                msyslog(LOG_ERR, "refclock_open %s: %m", dev);
                return (0);
        }
+       NTP_INSIST(fd != 0);
        if (!refclock_setup(fd, speed, lflags)) {
                close(fd);
                return (0);
@@ -769,6 +771,7 @@ refclock_open(
        return (fd);
 }
 
+
 /*
  * refclock_setup - initialize terminal interface structure
  */
@@ -1311,7 +1314,7 @@ refclock_pps(
        /*
         * 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)
index de3488631e9024c488b67c6fdf53b4f66f295ef1..ca14dc600fb4b4a4b93f580738aca94e754456da 100644 (file)
@@ -500,7 +500,7 @@ chu_start(
        snprintf(device, sizeof(device), DEVICE, unit);
        fd = refclock_open(device, SPEED232, LDISC_RAW);
 #endif /* HAVE_AUDIO */
-       if (fd < 0)
+       if (fd <= 0)
                return (0);
 
        /*
index 32e56f83d2b41aea299dff0000abb6fe81529c8c..f300ac9bc5a1cb33a5d34334a831e40635ca785b 100644 (file)
@@ -121,7 +121,7 @@ dumbclock_start(
                printf ("starting Dumbclock with device %s\n",device);
 #endif
        fd = refclock_open(device, SPEED232, 0);
-       if (fd < 0)
+       if (!fd)
                return (0);
 
        /*
index e327fb16f7127d9a3b5b59470bed0dfcb4378cd4..e53104bb5269020db76d04b031bd39b03e456714 100644 (file)
@@ -189,7 +189,7 @@ wwvb_start(
         * 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);
 
        /*
index 3d91fa9dcd2b526747befada8cd98db415b06810..4274216c659d4af45692a8f925ab68533e9c76e1 100644 (file)
@@ -6,6 +6,7 @@
 #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"
@@ -158,7 +159,7 @@ int tty_open(
  * 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 */
@@ -170,6 +171,7 @@ int refclock_open(
        HANDLE          h;
        COMMTIMEOUTS    timeouts;
        DCB             dcb;
+       int             fd;
 
        /*
         * open communication port handle
@@ -180,13 +182,13 @@ int refclock_open(
 
        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);
@@ -194,7 +196,7 @@ int refclock_open(
        if (!GetCommState(h, &dcb)) {
                msyslog(LOG_ERR, "Device %s GetCommState error: %m",
                                 windev);
-               return -1;
+               return 0;
        }
 
        switch (speed) {
@@ -238,7 +240,7 @@ int refclock_open(
        default:
                msyslog(LOG_ERR, "Device %s unsupported baud rate "
                                 "code %u", windev, speed);
-               return -1;
+               return 0;
        }
 
 
@@ -264,13 +266,13 @@ int refclock_open(
 
        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 */
@@ -282,10 +284,14 @@ int refclock_open(
 
        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;
 }