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 /libgps_sock.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 'libgps_sock.c')
-rw-r--r-- | libgps_sock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgps_sock.c b/libgps_sock.c index 7c19c639..923703c7 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -13,7 +13,7 @@ #include <math.h> #include <locale.h> #include <assert.h> -#include <sys/time.h> /* expected to have a select(2) prototype a la SuS */ +#include <sys/time.h> /* expected to have a pselect(2) prototype a la SuS */ #include <sys/types.h> #include <sys/stat.h> #include "gpsd_config.h" @@ -132,7 +132,7 @@ bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout) { #ifndef USE_QT fd_set rfds; - struct timeval tv; + struct timespec tv; libgps_debug_trace((DEBUG_CALLS, "gps_waiting(%d): %d\n", timeout, PRIVATE(gpsdata)->waitcount++)); if (PRIVATE(gpsdata)->waiting > 0) @@ -144,9 +144,9 @@ bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout) FD_ZERO(&rfds); FD_SET(gpsdata->gps_fd, &rfds); tv.tv_sec = timeout / 1000000; - tv.tv_usec = timeout % 1000000; + tv.tv_nsec = timeout % 1000000000; /* all error conditions return "not waiting" -- crude but effective */ - return (select(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv) == 1); + return (pselect(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv, NULL) == 1); #else return ((QTcpSocket *) (gpsdata->gps_fd))->waitForReadyRead(timeout / 1000); #endif |