diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2018-12-26 13:23:04 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2018-12-26 13:23:04 -0500 |
commit | 5517175ed53b877720fdf5a1a4085386b40c4590 (patch) | |
tree | 31c1ce53dea117cfb36a1e7d679cb785b32abdf8 /gpspipe.c | |
parent | c9e81aabcf2f5c6886be1fd0e859ceb63470e06f (diff) | |
download | gpsd-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.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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) { |