From 1998c0301f6f9542bf5dd51e8d18f3d7f4e76023 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 27 Dec 2018 05:39:42 -0500 Subject: Factor most uses of pselect(2) into a new utility function named 'nanowait'. Also, remove sime header inclusions discovered to be unnecessary during the change. --- driver_tsip.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'driver_tsip.c') diff --git a/driver_tsip.c b/driver_tsip.c index cb30394b..55010584 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -26,7 +26,6 @@ #endif -#include /* for pselect() */ #include #include #include @@ -37,8 +36,7 @@ #include "gpsd.h" #include "bits.h" #include "strfuncs.h" - -#include +#include "timespec.h" #define USE_SUPERPACKET 1 /* use Super Packet mode? */ @@ -85,8 +83,6 @@ static bool tsip_detect(struct gps_device_t *session) char buf[BUFSIZ]; bool ret = false; int myfd; - fd_set fdset; - struct timespec to; speed_t old_baudrate; char old_parity; unsigned int old_stopbits; @@ -105,11 +101,7 @@ static bool tsip_detect(struct gps_device_t *session) if (write(myfd, buf, 4) == 4) { unsigned int n; for (n = 0; n < 3; n++) { - FD_ZERO(&fdset); - FD_SET(myfd, &fdset); - to.tv_sec = 1; - to.tv_nsec = 0; - if (pselect(myfd + 1, &fdset, NULL, NULL, &to, NULL) != 1) + if (!nanowait(myfd, NS_IN_SEC)) break; if (generic_get(session) >= 0) { if (session->lexer.type == TSIP_PACKET) { -- cgit v1.2.1