summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernd Zeimetz <bernd@bzed.de>2012-07-01 22:08:57 +0200
committerBernd Zeimetz <bernd@bzed.de>2012-07-01 22:08:57 +0200
commit4e3307756fb4ade7ee38fd4793438640e6bb9c47 (patch)
tree755646648503021da0b5ab22a2ba838fae24c07a
parentc5623daa22b0659e90268edd37941e941ae8c56a (diff)
downloadgpsd-4e3307756fb4ade7ee38fd4793438640e6bb9c47.tar.gz
Include unistd.h as workaround for timepps.h missing it.
Also remove a duplicate include of timepps.h from ntpshm.h, moving the comment to gpsd.h-tail
-rw-r--r--gpsd.h-tail9
-rw-r--r--ntpshm.c12
2 files changed, 9 insertions, 12 deletions
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 270af7eb..2e65d9e6 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -9,7 +9,16 @@
#include <stdint.h>
#include "gps.h"
+/* use RFC 2782 PPS API */
+/* this needs linux >= 2.6.34 and
+ * CONFIG_PPS=y
+ * CONFIG_PPS_DEBUG=y [optional to kernel log pulses]
+ * CONFIG_PPS_CLIENT_LDISC=y
+ */
#if defined(HAVE_SYS_TIMEPPS_H)
+// include unistd.h here as it is missing on older pps-tools releases.
+// 'close' is not defined otherwise.
+#include <unistd.h>
#include <sys/timepps.h>
#endif
diff --git a/ntpshm.c b/ntpshm.c
index 38e44414..907fc82c 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -389,18 +389,6 @@ static int ntpshm_pps(struct gps_device_t *session, struct timeval *tv)
#ifndef S_SPLINT_S
#include <pthread.h> /* pacifies OpenBSD's compiler */
#endif
-#if defined(HAVE_SYS_TIMEPPS_H)
- /* use RFC 2783 PPS API */
- /* this needs linux >= 2.6.34 and
- * CONFIG_PPS=y
- * CONFIG_PPS_DEBUG=y [optional to kernel log pulses]
- * CONFIG_PPS_CLIENT_LDISC=y
- */
- /* get timepps.h from the pps-tools package, or from here:
- * http://www.mail-archive.com/debian-glibc@lists.debian.org/msg43125.html
- * RFC2783 says timepps.h is in sys
- */
- #include <sys/timepps.h>
#include <glob.h>
#endif
/* and for chrony */