summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/refclock_datum.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2008-08-22 15:58:00 +0000
committerroberto <roberto@FreeBSD.org>2008-08-22 15:58:00 +0000
commitb85c7169a740b2edf0106ad59fdaa1b0160f823c (patch)
tree2b9fb7f64eacb322e95695e412c923e97ba33e88 /contrib/ntp/ntpd/refclock_datum.c
parent1d197cfe9feac6bc29537d8e53c30b6435937b95 (diff)
parent7a6072eb585696f8856cd498c3fd194cf49f14c6 (diff)
downloadFreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.zip
FreeBSD-src-b85c7169a740b2edf0106ad59fdaa1b0160f823c.tar.gz
Merge ntpd & friends 4.2.4p5 from vendor/ntp/dist into head. Next commit
will update usr.sbin/ntp to match this. MFC after: 2 weeks
Diffstat (limited to 'contrib/ntp/ntpd/refclock_datum.c')
-rw-r--r--contrib/ntp/ntpd/refclock_datum.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/ntp/ntpd/refclock_datum.c b/contrib/ntp/ntpd/refclock_datum.c
index 82b7369..b26fe73 100644
--- a/contrib/ntp/ntpd/refclock_datum.c
+++ b/contrib/ntp/ntpd/refclock_datum.c
@@ -119,6 +119,7 @@
#define REFID "DATM" /* reference id */
#define DATUM_DISPERSION 0 /* fixed dispersion = 0 ms */
#define DATUM_MAX_ERROR 0.100 /* limits on sigma squared */
+#define DATUM_DEV "/dev/datum" /* device name */
#define DATUM_MAX_ERROR2 (DATUM_MAX_ERROR*DATUM_MAX_ERROR)
@@ -233,6 +234,7 @@ datum_pts_start(
{
struct datum_pts_unit **temp_datum_pts_unit;
struct datum_pts_unit *datum_pts;
+ int fd;
#ifdef HAVE_TERMIOS
struct termios arg;
#endif
@@ -243,6 +245,16 @@ datum_pts_start(
#endif
/*
+ ** Open the Datum PTS device
+ */
+ fd = open(DATUM_DEV, O_RDWR);
+
+ if (fd < 0) {
+ msyslog(LOG_ERR, "Datum_PTS: open(\"%s\", O_RDWR) failed: %m", DATUM_DEV);
+ return 0;
+ }
+
+ /*
** Create the memory for the new unit
*/
@@ -260,11 +272,7 @@ datum_pts_start(
datum_pts->yearstart = 0; /* initialize the yearstart to 0 */
datum_pts->sigma2 = 0.0; /* initialize the sigma2 to 0 */
- /*
- ** Open the Datum PTS device
- */
-
- datum_pts->PTS_fd = open("/dev/datum",O_RDWR);
+ datum_pts->PTS_fd = fd;
fcntl(datum_pts->PTS_fd, F_SETFL, 0); /* clear the descriptor flags */
OpenPOWER on IntegriCloud