summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/ntp_refclock.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2000-01-28 14:55:50 +0000
committerroberto <roberto@FreeBSD.org>2000-01-28 14:55:50 +0000
commitb5b40f9e420899251189775800d9f74092925299 (patch)
tree98efdf1b74d6ecb7828bb502a0350116eeb2fd3c /contrib/ntp/ntpd/ntp_refclock.c
parentef64b99e8412f2273dd2e8b3291c2f78ffc4667f (diff)
downloadFreeBSD-src-b5b40f9e420899251189775800d9f74092925299.zip
FreeBSD-src-b5b40f9e420899251189775800d9f74092925299.tar.gz
Virgin import of ntpd 4.0.99b
Diffstat (limited to 'contrib/ntp/ntpd/ntp_refclock.c')
-rw-r--r--contrib/ntp/ntpd/ntp_refclock.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/contrib/ntp/ntpd/ntp_refclock.c b/contrib/ntp/ntpd/ntp_refclock.c
index c7b9166..c47031c 100644
--- a/contrib/ntp/ntpd/ntp_refclock.c
+++ b/contrib/ntp/ntpd/ntp_refclock.c
@@ -20,11 +20,12 @@
#ifdef REFCLOCK
#ifdef TTYCLK
-# ifdef SCO5_CLOCK
-# include <sys/sio.h>
-# else
+# ifdef HAVE_SYS_CLKDEFS_H
# include <sys/clkdefs.h>
# endif
+# ifdef HAVE_SYS_SIO_H
+# include <sys/sio.h>
+# endif
#endif /* TTYCLK */
#ifdef HAVE_PPSCLOCK_H
@@ -32,7 +33,13 @@
#endif /* HAVE_PPSCLOCK_H */
#ifdef HAVE_PPSAPI
-#include <sys/timepps.h>
+# ifdef HAVE_TIMEPPS_H
+# include <timepps.h>
+# else
+# ifdef HAVE_SYS_TIMEPPS_H
+# include <sys/timepps.h>
+# endif
+# endif
#endif /* HAVE_PPSAPI */
/*
@@ -755,10 +762,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 */
@@ -775,6 +783,9 @@ refclock_open(
/*
* 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
@@ -936,12 +947,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 */
OpenPOWER on IntegriCloud