summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorMatt <ukyg9e5r6k7gubiekd6@yahoo.com>2014-09-06 17:24:28 +1000
committerEric S. Raymond <esr@thyrsus.com>2014-09-06 03:26:42 -0400
commitf306fbd42b65b8b1ad9ef40ad7bc38f18a5318a9 (patch)
tree54355a43a3c0b84204a4009f2d5e05bfea6fa744 /serial.c
parent14aeb2bfdbd54220876e0a80092ddd7f522fe361 (diff)
downloadgpsd-f306fbd42b65b8b1ad9ef40ad7bc38f18a5318a9.tar.gz
Handle lack of TIOCEXCL and TIOCNXCL on cygwin
The cygwin headers don't seem to define these. We can still attempt to work without them.
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/serial.c b/serial.c
index 3fbfcde3..66107f70 100644
--- a/serial.c
+++ b/serial.c
@@ -443,12 +443,14 @@ int gpsd_serial_open(struct gps_device_t *session)
* We also exclude bluetooth device because the bluetooth daemon opens them.
*/
if (!(session->sourcetype == source_pty || session->sourcetype == source_bluetooth)) {
+#ifdef TIOCEXCL
/*
* Try to block other processes from using this device while we
* have it open (later opens should return EBUSY). Won't work
* against anything with root privileges, alas.
*/
(void)ioctl(session->gpsdata.gps_fd, (unsigned long)TIOCEXCL);
+#endif /* TIOCEXCL */
#ifdef __linux__
/*
@@ -631,7 +633,9 @@ void gpsd_assert_sync(struct gps_device_t *session)
void gpsd_close(struct gps_device_t *session)
{
if (!BAD_SOCKET(session->gpsdata.gps_fd)) {
+#ifdef TIOCNXCL
(void)ioctl(session->gpsdata.gps_fd, (unsigned long)TIOCNXCL);
+#endif /* TIOCNXCL */
(void)tcdrain(session->gpsdata.gps_fd);
if (isatty(session->gpsdata.gps_fd) != 0) {
/* force hangup on close on systems that don't do HUPCL properly */