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 /gps2udp.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 'gps2udp.c')
-rw-r--r-- | gps2udp.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -15,6 +15,11 @@ /* strsep() 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> #include "gpsd_config.h" @@ -230,7 +235,7 @@ static void connect2gpsd(bool restart) static ssize_t read_gpsd(char *message, size_t len) /* get data from gpsd */ { - struct timeval tv; + struct timespec tv; fd_set fds,master; int ind; char c; @@ -248,9 +253,9 @@ static ssize_t read_gpsd(char *message, size_t len) int result; /* prepare for a blocking read with a 10s timeout */ tv.tv_sec = 10; - tv.tv_usec = 0; + tv.tv_nsec = 0; fds = master; - result = select(gpsdata.gps_fd+1, &fds, NULL, NULL, &tv); + result = pselect(gpsdata.gps_fd+1, &fds, NULL, NULL, &tv, NULL); switch (result) { |