📄 173
字号:
Replied: Mon, 26 Jan 1998 23:32:15 -0500Replied: "Craig Leres <leres@ee.lbl.gov> Marc Brett <Marc.Brett@waii.com>, mills@udel.edu,Replied: frank.vance@merlin.london.waii.com"Received: from mail.eecis.udel.edu by whimsy.udel.edu id aa22898; 24 Jan 1998 01:13 ESTReceived: by hot.ee.lbl.gov (8.8.8/8.8.5) id WAA01962; Fri, 23 Jan 1998 22:13:30 -0800 (PST)Message-Id: <199801240613.WAA01962@hot.ee.lbl.gov>To: Marc Brett <Marc.Brett@waii.com>Cc: stenn@whimsy.udel.edu, mills@udel.edu, frank.vance@merlin.london.waii.com, marc.brett@merlin.london.waii.comSubject: Re: Fixes for MX4200 driverIn-reply-to: Your message of Fri, 23 Jan 1998 15:30:05 PST.Date: Fri, 23 Jan 1998 22:13:30 PSTFrom: Craig Leres <leres@ee.lbl.gov>> Note that they incorporate most of the *bug* fixes noted by Craig Leres on> July 17 1997 (xntp3-5.92-export/patches/inbox/3), and a few additional ones> (incorrect sentences were being passed to the receiver).> > Unfortunately, none of Craig's *portability* patches for FreeBSD are> in here, not least because I don't have a FreeBSD platform on which to> test the code. I tried to get automake and autoconf to behave, but got> nowhere. I agree that AC_REPLACE_FUNCS(strerror) is probably the way to> go, though.I brought up 5.92 tonight and the changes I needed are appended.Included are the autoconf stuff I needed to make strerror work, theJupiter gps module and some other stuff. I am running this versionunder FreeBSD 2.2.2-RELEASE with a Jupiter and SunOS 4.1.4 with aMX4200. I did test the Jupiter module under SunOS 4.1.4 recently but amnot currently running it with one on that os.One problem I'm having both under SunOS 4.1.4 and FreeBSD 2.2.2-RELEASEis the stupid "DEPS_MAGIC :=" crap automake puts in the makefiles. Ispent some time poking at automake but don't see how to keep it fromdoing this. (I knew there was at least one reason we never useautomake...) Anyway, I wrote the appended script to comment them out.If you'd like me to test 5.93 before you release it, please let me know. Craig------ include/ntp.h (first of several context diffs)*** /tmp/,RCSt1a14433 Fri Jan 23 21:48:09 1998--- ntp.h Fri Jan 23 18:08:19 1998****************** 429,434 ****--- 429,435 ---- #define REFCLK_GPS_HP 26 /* HP 58503A Time & Frequency Receiver */ #define REFCLK_ARCRON_MSF 27 /* ARCRON MSF radio clock. */ #define REFCLK_SHM 28 /* clock attached thru shared memory */+ #define REFCLK_GPS_JUPITER 29 /* Rockwell Jupiter GPS receiver */ #define REFCLK_MAX 30 /* maximum index (room to expand) */ /*------ libntp/Makefile.am*** /tmp/,RCSt1a14463 Fri Jan 23 21:51:19 1998--- Makefile.am Fri Jan 23 21:06:19 1998****************** 11,16 ****--- 11,17 ---- utvtoa.c machines.c clocktypes.c md5.c a_md5encrypt.c a_md5decrypt.c \ a_md512crypt.c decodenetnum.c systime.c msyslog.c syssignal.c \ findconfig.c netof.c statestr.c mexit.c+ libntp_a_LIBADD = @LIBOBJS@ INCLUDES = -I$(top_srcdir)/include ETAGS_ARGS = Makefile.am ------ libntp/clocktypes.c*** /tmp/,RCSt1a14478 Fri Jan 23 21:52:23 1998--- clocktypes.c Fri Jan 23 18:09:43 1998****************** 68,73 ****--- 68,75 ---- "ARCRON_MSF" }, { REFCLK_SHM, "Clock attached thru shared Memory (28)", "SHM" },+ { REFCLK_GPS_JUPITER, "Rockwell Jupiter GPS Receiver (29)",+ "GPS_JUPITER" }, { -1, "", "" } };------ ntpdate/ntpdate.c*** /tmp/,RCSt1a14488 Fri Jan 23 21:52:59 1998--- ntpdate.c Fri Jan 23 18:54:39 1998****************** 17,22 ****--- 17,25 ---- #include <signal.h> #include <ctype.h> #include <errno.h>+ #ifdef HAVE_POLL_H+ #include <poll.h>+ #endif #ifndef SYS_WINNT #include <netdb.h> #include <sys/signal.h>****************** 93,99 ****--- 96,106 ---- * File descriptor masks etc. for call to select */ int fd;+ #ifdef HAVE_POLL_H+ struct pollfd fdmask;+ #else fd_set fdmask;+ #endif /* * Initializing flag. All async routines watch this and only do their****************** 514,520 ****--- 521,531 ---- was_alarmed = 0; rbuflist = (struct recvbuf *)0; while (complete_servers < sys_numservers) {+ #ifdef HAVE_POLL_H+ struct pollfd rdfdes;+ #else fd_set rdfdes;+ #endif int nfound; if (alarm_flag) { /* alarmed? */****************** 533,540 ****--- 544,555 ---- timeout.tv_usec = 0; rdfdes = fdmask; #ifndef SYS_VXWORKS+ #ifdef HAVE_POLL_H+ nfound = poll(&rdfdes, 1, timeout.tv_sec * 1000);+ #else nfound = select(fd+1, &rdfdes, (fd_set *)0, (fd_set *)0, &timeout);+ #endif #else nfound = select(fd+1, &rdfdes, (fd_set *)0, (fd_set *)0, &tv0);****************** 551,561 ****--- 566,584 ---- #ifndef SYS_WINNT if (errno != EINTR) #endif+ #ifdef HAVE_POLL_H+ msyslog(LOG_ERR, "poll() error: %m");+ #else msyslog(LOG_ERR, "select() error: %m");+ #endif } else { #ifndef SYS_VXWORKS+ #ifdef HAVE_POLL_H+ msyslog(LOG_DEBUG, "poll(): nfound = %d, error: %m", nfound);+ #else msyslog(LOG_DEBUG, "select(): nfound = %d, error: %m", nfound); #endif+ #endif } if (alarm_flag) { /* alarmed? */ was_alarmed = 1;****************** 1560,1567 ****--- 1583,1595 ---- } } + #ifdef HAVE_POLL_H+ fdmask.fd = fd;+ fdmask.events = POLLIN;+ #else FD_ZERO(&fdmask); FD_SET(fd, &fdmask);+ #endif /* * set non-blocking,****************** 1691,1697 ****--- 1719,1729 ---- struct timeval tvzero; int fromlen; l_fp ts;+ #ifdef HAVE_POLL_H+ struct pollfd fds;+ #else fd_set fds;+ #endif /* * Do a poll to see if we have data****************** 1699,1705 ****--- 1731,1741 ---- for (;;) { fds = fdmask; tvzero.tv_sec = tvzero.tv_usec = 0;+ #ifdef HAVE_POLL_H+ n = poll(&fds, 1, tvzero.tv_sec * 1000);+ #else n = select(fd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero);+ #endif /* * If nothing to do, just return. If an error occurred,****************** 1710,1716 ****--- 1746,1756 ---- return; else if (n == -1) { if (errno != EINTR)+ #ifdef HAVE_POLL_H+ msyslog(LOG_ERR, "poll() error: %m");+ #else msyslog(LOG_ERR, "select() error: %m");+ #endif return; } get_systime(&ts);------ xntpd/Makefile.am*** /tmp/,RCSt1a14498 Fri Jan 23 21:53:28 1998--- Makefile.am Fri Jan 23 18:18:11 1998****************** 12,18 **** ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \ ntp_unixclock.c ntp_util.c ntp_intres.c ntp_filegen.c ntpd.c \ refclock_conf.c refclock_chu.c refclock_local.c \! refclock_pst.c refclock_wwvb.c refclock_mx4200.c \ refclock_parse.c refclock_as2201.c refclock_bancomm.c \ refclock_tpro.c refclock_leitch.c refclock_irig.c \ refclock_msfees.c refclock_trak.c refclock_datum.c \--- 12,18 ---- ntp_refclock.c ntp_request.c ntp_restrict.c ntp_timer.c \ ntp_unixclock.c ntp_util.c ntp_intres.c ntp_filegen.c ntpd.c \ refclock_conf.c refclock_chu.c refclock_local.c \! refclock_pst.c refclock_wwvb.c refclock_mx4200.c refclock_jupiter.c \ refclock_parse.c refclock_as2201.c refclock_bancomm.c \ refclock_tpro.c refclock_leitch.c refclock_irig.c \ refclock_msfees.c refclock_trak.c refclock_datum.c \------ xntpd/refclock_conf.c*** /tmp/,RCSt1a14503 Fri Jan 23 21:53:37 1998--- refclock_conf.c Fri Jan 23 18:18:31 1998****************** 174,179 ****--- 174,185 ---- #define refclock_shm refclock_none #endif + #if defined(JUPITER) && defined(PPS)+ extern struct refclock refclock_jupiter;+ #else+ #define refclock_jupiter refclock_none+ #endif+ /* * Order is clock_start(), clock_shutdown(), clock_poll(), * clock_control(), clock_init(), clock_buginfo, clock_flags;****************** 210,216 **** &refclock_hpgps, /* 26 REFCLK_GPS_HP */ &refclock_arc, /* 27 REFCLK_ARCRON_MSF */ &refclock_shm, /* 28 REFCLK_SHM */! &refclock_none, /* 29 reserved */ &refclock_none, /* 30 reserved */ }; --- 216,222 ---- &refclock_hpgps, /* 26 REFCLK_GPS_HP */ &refclock_arc, /* 27 REFCLK_ARCRON_MSF */ &refclock_shm, /* 28 REFCLK_SHM */! &refclock_jupiter, /* 29 REFCLK_JUPITER */ &refclock_none, /* 30 reserved */ }; ------ xntpd/refclock_mx4200.c*** /tmp/,RCSt1a14518 Fri Jan 23 21:53:52 1998--- refclock_mx4200.c Fri Jan 23 18:28:45 1998****************** 76,81 ****--- 76,86 ---- */ /*+ * Check this every time you edit the code!+ */+ #define YEAR_RIGHT_NOW 1998+ + /* * GPS Definitions */ #define DEVICE "/dev/gps%d" /* device name and unit */****************** 129,141 **** #endif /* PPS */ /*- * Imported from perror(3)- */- extern int sys_nerr;- extern char *sys_errlist[];- extern int errno;- - /* * MX4200 unit control structure. */ struct mx4200unit {--- 134,139 ----****************** 169,174 ****--- 167,186 ---- static char pmvxg[] = "PMVXG"; + /* XXX should be somewhere else */+ #ifdef __GNUC__+ #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)+ #ifndef __attribute__+ #define __attribute__(args)+ #endif+ #endif+ #else+ #ifndef __attribute__+ #define __attribute__(args)+ #endif+ #endif+ /* XXX end */+ /* * Function prototypes */****************** 190,199 **** #endif /* not QSORT_USES_VOID_P */ static void mx4200_config P((struct peer *)); static void mx4200_ref P((struct peer *));! static void mx4200_send P((struct peer *, char *, ...)); static u_char mx4200_cksum P((char *, u_int)); static int mx4200_jday P((int, int, int));! static void mx4200_debug P((struct peer *, char *, ...)); static int mx4200_pps P((struct peer *)); /*--- 202,213 ---- #endif /* not QSORT_USES_VOID_P */ static void mx4200_config P((struct peer *)); static void mx4200_ref P((struct peer *));! static void mx4200_send P((struct peer *, char *, ...))! __attribute__ ((format (printf, 2, 3))); static u_char mx4200_cksum P((char *, u_int)); static int mx4200_jday P((int, int, int));! static void mx4200_debug P((struct peer *, char *, ...))! __attribute__ ((format (printf, 2, 3))); static int mx4200_pps P((struct peer *)); /******************* 297,303 **** struct peer *peer; { char tr_mode;! char add_mode; int i; register struct mx4200unit *up; struct refclockproc *pp;--- 311,317 ---- struct peer *peer; { char tr_mode;! int add_mode; int i; register struct mx4200unit *up; struct refclockproc *pp;****************** 424,434 **** if (up->moving) { /* dynamic: solve for pos, alt, time, while moving */ tr_mode = 'D';- add_mode = 0; } else { /* static: solve for pos, alt, time, while stationary */ tr_mode = 'S';- add_mode = 1; } mx4200_send(peer, "%s,%03d,%c,%c,%c,%d,%d,%d,", pmvxg, PMVXG_S_TRECOVCONF,--- 438,446 ----****************** 445,451 **** * location) only if we are not moving */ if (up->moving) {! add_mode = 0; /* delete from list */ } else { add_mode = 1; /* add to list */ }--- 457,463 ---- * location) only if we are not moving */ if (up->moving) {! add_mode = 2; /* delete from list */ } else { add_mode = 1; /* add to list */ }****************** 458,464 **** PMVXG_S_PORTCONF, PMVXG_D_DOPS, /* control port output block Label */ 0, /* clear current output control list (0=no) */! add_mode, /* add/delete sentences from list (1=add) */ /* must be null */ INTERVAL); /* sentence output rate (sec) */ /* precision for position output */--- 470,476 ---- PMVXG_S_PORTCONF, PMVXG_D_DOPS, /* control port output block Label */ 0, /* clear current output control list (0=no) */! add_mode, /* add/delete sentences from list (1=add, 2=del) */ /* must be null */ INTERVAL); /* sentence output rate (sec) */ /* precision for position output */****************** 474,480 **** PMVXG_S_PORTCONF, PMVXG_D_PHV, /* control port output block Label */ 0, /* clear current output control list (0=no) */! add_mode, /* add/delete sentences from list (1=add) */ /* must be null */ INTERVAL); /* sentence output rate (sec) */ /* precision for position output */--- 486,492 ---- PMVXG_S_PORTCONF, PMVXG_D_PHV, /* control port output block Label */ 0, /* clear current output control list (0=no) */! add_mode, /* add/delete sentences from list (1=add, 2=del) */ /* must be null */ INTERVAL); /* sentence output rate (sec) */ /* precision for position output */****************** 579,591 **** * "007" Control Port Configuration * Stop outputting "022" DOPs */! mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -