From: Harlan Stenn Date: Sat, 4 Dec 1999 22:35:14 +0000 (-0000) Subject: ChangeLog, ntp_refclock.h, ntp_refclock.c, refclock_mx4200.c: X-Git-Tag: NTP_4_0_98_G~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f507b1da4a66127d43bf22fa6a3ecb997b7d59c0;p=thirdparty%2Fntp.git ChangeLog, ntp_refclock.h, ntp_refclock.c, refclock_mx4200.c: * ntpd/ntp_refclock.c (refclock_open): "flags" processing cleanup (refclock_open): PPS device initialization cleanup * include/ntp_refclock.h (LDISC_CHU): (LDISC_PPS): Clean up comments From: Dave Mills bk: 38499722uODhzKzw0x_uDQ2p4MEY7Q --- diff --git a/ChangeLog b/ChangeLog index 1adc3366f0..218f2b63ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +1999-12-04 Harlan Stenn + + * ntpd/ntp_refclock.c (refclock_open): "flags" processing cleanup + (refclock_open): PPS device initialization cleanup + * include/ntp_refclock.h (LDISC_CHU): + (LDISC_PPS): Clean up comments + From: Dave Mills + 1999-12-03 Sven Dietrich * libntp/mexit.c: Moved WINNT port specific file to ports/winnt/libntp diff --git a/include/ntp_refclock.h b/include/ntp_refclock.h index ad278a3c55..fd1d0801d9 100644 --- a/include/ntp_refclock.h +++ b/include/ntp_refclock.h @@ -165,8 +165,8 @@ struct refclockbug { #define LDISC_CLK 0x1 /* tty_clk \n intercept */ #define LDISC_CLKPPS 0x2 /* tty_clk \377 intercept */ #define LDISC_ACTS 0x4 /* tty_clk #* intercept */ -#define LDISC_CHU 0x8 /* tty_chu */ -#define LDISC_PPS 0x10 /* ppsclock */ +#define LDISC_CHU 0x8 /* depredated */ +#define LDISC_PPS 0x10 /* ppsclock, ppsapi */ #define LDISC_RAW 0x20 /* raw binary */ struct refclockproc { diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index 0845ffc84a..b40bd5b23d 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -756,10 +756,11 @@ int refclock_open( char *dev, /* device name pointer */ int speed, /* serial port speed (code) */ - int flags /* line discipline flags */ + int lflags /* line discipline flags */ ) { int fd, i; + int flags; #ifdef HAVE_TERMIOS struct termios ttyb, *ttyp; #endif /* HAVE_TERMIOS */ @@ -773,9 +774,16 @@ refclock_open( u_long ltemp; #endif /* TIOCMGET */ + flags = lflags; + if (strcmp(dev, pps_device) == 0) + flags |= LDISC_PPS; + /* * Open serial port and set default options */ + flags = lflags; + if (strcmp(dev, pps_device) == 0) + flags |= LDISC_PPS; #ifdef O_NONBLOCK fd = open(dev, O_RDWR | O_NONBLOCK, 0777); #else @@ -937,12 +945,6 @@ refclock_open( "refclock_open: fd %d ioctl failed: %m", fd); return (0); } - - /* - * If this is the PPS device, so say and initialize the thing. - */ - if (strcmp(dev, pps_device) == 0) - (void)refclock_ioctl(fd, LDISC_PPS); return (fd); } #endif /* HAVE_TERMIOS || HAVE_SYSV_TTYS || HAVE_BSD_TTYS */ @@ -958,7 +960,7 @@ refclock_open( * their many other variants. The routine returns 1 if success and 0 if * failure. */ -int +static int refclock_ioctl( int fd, /* file descriptor */ int flags /* line discipline flags */ diff --git a/ntpd/refclock_mx4200.c b/ntpd/refclock_mx4200.c index 28f563f8a8..16791b6c45 100644 --- a/ntpd/refclock_mx4200.c +++ b/ntpd/refclock_mx4200.c @@ -246,7 +246,7 @@ mx4200_start( * Open serial port */ (void)sprintf(gpsdev, DEVICE, unit); - if (!(fd = refclock_open(gpsdev, SPEED232, LDISC_PPS))) { + if (!(fd = refclock_open(gpsdev, SPEED232))) { return (0); } #ifdef HAVE_TIOCGPPSEV