summaryrefslogtreecommitdiff
path: root/driver_geostar.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2018-12-26 13:23:04 -0500
committerEric S. Raymond <esr@thyrsus.com>2018-12-26 13:23:04 -0500
commit5517175ed53b877720fdf5a1a4085386b40c4590 (patch)
tree31c1ce53dea117cfb36a1e7d679cb785b32abdf8 /driver_geostar.c
parentc9e81aabcf2f5c6886be1fd0e859ceb63470e06f (diff)
downloadgpsd-5517175ed53b877720fdf5a1a4085386b40c4590.tar.gz
Eliminate effectively all uses of struct timeval.
Outide of one Mac portability shim, anyway. Associated select(2) calls become pselect(2) calls.
Diffstat (limited to 'driver_geostar.c')
-rw-r--r--driver_geostar.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/driver_geostar.c b/driver_geostar.c
index 306ca3e9..127d92e1 100644
--- a/driver_geostar.c
+++ b/driver_geostar.c
@@ -10,7 +10,12 @@
* SPDX-License-Identifier: BSD-2-clause
*/
-#include <sys/time.h> /* for select() */
+#ifdef __linux__
+/* isfinite() and pselect() needs _POSIX_C_SOURCE >= 200112L */
+#define _POSIX_C_SOURCE 200112L
+#endif /* __linux__ */
+
+#include <sys/time.h> /* for pselect() */
#include <stdbool.h>
#include <stdio.h>
#include <math.h>
@@ -87,7 +92,7 @@ static bool geostar_detect(struct gps_device_t *session)
bool ret = false;
int myfd;
fd_set fdset;
- struct timeval to;
+ struct timespec to;
myfd = session->gpsdata.gps_fd;
@@ -99,8 +104,8 @@ static bool geostar_detect(struct gps_device_t *session)
FD_ZERO(&fdset);
FD_SET(myfd, &fdset);
to.tv_sec = 1;
- to.tv_usec = 0;
- if (select(myfd + 1, &fdset, NULL, NULL, &to) != 1)
+ to.tv_nsec = 0;
+ if (pselect(myfd + 1, &fdset, NULL, NULL, &to, NULL) != 1)
break;
if (generic_get(session) >= 0) {
if (session->lexer.type == GEOSTAR_PACKET) {