summaryrefslogtreecommitdiff
path: root/gpspipe.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 /gpspipe.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 'gpspipe.c')
-rw-r--r--gpspipe.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gpspipe.c b/gpspipe.c
index 1e8d822f..39f6c301 100644
--- a/gpspipe.c
+++ b/gpspipe.c
@@ -26,6 +26,10 @@
/* cfmakeraw() needs _DEFAULT_SOURCE */
#define _DEFAULT_SOURCE
+#ifdef __linux__
+/* isfinite() and pselect() needs _POSIX_C_SOURCE >= 200112L */
+#define _POSIX_C_SOURCE 200112L
+#endif /* __linux__ */
#include <time.h> /* for time_t */
#include "gpsd_config.h"
@@ -327,14 +331,14 @@ int main(int argc, char **argv)
for (;;) {
int r = 0;
- struct timeval tv;
+ struct timespec tv;
tv.tv_sec = 0;
- tv.tv_usec = 100000;
+ tv.tv_nsec = 100000000;
FD_ZERO(&fds);
FD_SET(gpsdata.gps_fd, &fds);
errno = 0;
- r = select(gpsdata.gps_fd+1, &fds, NULL, NULL, &tv);
+ r = pselect(gpsdata.gps_fd+1, &fds, NULL, NULL, &tv, NULL);
if (r >= 0 && exit_timer && time(NULL) >= exit_timer)
break;
if (r == -1 && errno != EINTR) {