diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-02 06:33:54 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-02 06:33:54 -0500 |
commit | d898a7d56d9f9a9fc877049ad7f2b31dc1a5a6e7 (patch) | |
tree | 2f673beb27c06a4e0e38214d9f4e93bf9d34c3b8 | |
parent | ede118ecbb53c2e903965a67d57f841ce4b8fc85 (diff) | |
download | gpsd-d898a7d56d9f9a9fc877049ad7f2b31dc1a5a6e7.tar.gz |
Use pselect unconditionally. We're assuming POSIX-2001.1 conformance.
All regression tests pass.
-rw-r--r-- | SConstruct | 5 | ||||
-rw-r--r-- | build.txt | 4 | ||||
-rw-r--r-- | gpsctl.c | 9 | ||||
-rw-r--r-- | libgpsd_core.c | 11 | ||||
-rw-r--r-- | www/hacking.html.in | 8 |
5 files changed, 6 insertions, 31 deletions
@@ -703,11 +703,6 @@ else: else: confdefs.append("#define %s \"%s\"\n" % (key.upper(), value)) - if config.CheckFunc("pselect"): - confdefs.append("/* #undef COMPAT_SELECT */\n") - else: - confdefs.append("#define COMPAT_SELECT\n") - if config.CheckHeader(["sys/types.h", "sys/time.h", "sys/timepps.h"]): confdefs.append("#define HAVE_SYS_TIMEPPS_H 1\n") kpps = True @@ -31,9 +31,7 @@ We consider failure to build and function on any of these platforms a serious bug; if you encounter it, please complain on the development list. -Macintosh OS X has been dropped from the list of supported platforms -due to serial-layer flakiness that has persisted through 10.9 and -10.10. +Port difficulty to any system conforming to POSIX-2001.1 should be minimal. A Cygwin port is in progress but not complete. @@ -71,9 +71,6 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata, char buf[BUFSIZ]; va_list ap; time_t starttime; -#ifdef COMPAT_SELECT - struct timeval tv; -#else struct timespec tv; sigset_t oldset, blockset; @@ -83,7 +80,6 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata, (void)sigaddset(&blockset, SIGTERM); (void)sigaddset(&blockset, SIGQUIT); (void)sigprocmask(SIG_BLOCK, &blockset, &oldset); -#endif /* COMPAT_SELECT */ va_start(ap, fmt); (void)vsnprintf(buf, sizeof(buf)-2, fmt, ap); @@ -107,13 +103,8 @@ static bool gps_query(/*@out@*/struct gps_data_t *gpsdata, /*@ -usedef -type -nullpass -compdef @*/ tv.tv_sec = 2; -#ifdef COMPAT_SELECT - tv.tv_usec = 0; - if (select(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv) == -1) { -#else tv.tv_nsec = 0; if (pselect(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv, &oldset) == -1) { -#endif if (errno == EINTR || !FD_ISSET(gpsdata->gps_fd, &rfds)) continue; gpsd_report(&context.errout, LOG_ERROR, "select %s\n", strerror(errno)); diff --git a/libgpsd_core.c b/libgpsd_core.c index 16ac261e..a8cd72e3 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -998,9 +998,6 @@ int gpsd_await_data(/*@out@*/fd_set *rfds, /* await data from any socket in the all_fds set */ { int status; -#ifdef COMPAT_SELECT - struct timeval tv; -#endif /* COMPAT_SELECT */ FD_ZERO(efds); (void)memcpy((char *)rfds, (char *)all_fds, sizeof(fd_set)); @@ -1013,20 +1010,14 @@ int gpsd_await_data(/*@out@*/fd_set *rfds, * select(2) has to poll here as small as possible (for * low-clock-rate SBCs and the like). * - * pselect() is preferable, when we can have it, to eliminate + * pselect() is preferable to vanilla select, to eliminate * the once-per-second wakeup when no sensors are attached. * This cuts power consumption. */ /*@ -usedef -nullpass @*/ errno = 0; -#ifdef COMPAT_SELECT - tv.tv_sec = 1; - tv.tv_usec = 0; - status = select(maxfd + 1, rfds, NULL, NULL, &tv); -#else status = pselect(maxfd + 1, rfds, NULL, NULL, NULL, NULL); -#endif if (status == -1) { if (errno == EINTR) return AWAIT_NOT_READY; diff --git a/www/hacking.html.in b/www/hacking.html.in index bbe36258..1ebaae96 100644 --- a/www/hacking.html.in +++ b/www/hacking.html.in @@ -511,10 +511,10 @@ uClibc. Instead, rely on what POSIX guarantees.</p> formatting. Be aware that if your patch seems disharmonious with what is around it, your code may be reformatted, so try to blend in.</p> -<p>You may rely on a full POSIX and Single Unix Standard binding to -the operating system. Someday it is possible we may have a Windows -port, but we refuse to cripple or overcomplicate the codebase in -advance.</p> +<p>You may rely on a full POSIX (in particular, POSIX-2001.1) and +Single Unix Standard binding to the operating system. Someday it is +possible we may have a Windows port, but we refuse to cripple or +overcomplicate the codebase in advance.</p> <p>Do not litter the code with undocumented magic numbers! This is especially important for buffer lengths, because unsynchronized |