diff options
author | Fred Wright <fw@fwright.net> | 2016-01-21 13:35:39 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2016-01-21 13:35:39 -0500 |
commit | b436b11635c5f95f7ec5fef455ff197ae96106da (patch) | |
tree | 7ebd80196c04ac278515e66a090a1f6dc4235241 /gpsd.c | |
parent | d47101a2759b3af0ba2b56348d680d379b5e8362 (diff) | |
download | gpsd-b436b11635c5f95f7ec5fef455ff197ae96106da.tar.gz |
Fix build on OS/X < 10.6
OSX versions earlier than 10.6 fail to define IPV6_TCLASS, causing the
compile of gpsd.c to fail. There is already a fallback definition for
Gnu/Hurd. The attached patch:
1) Extends the existing Gnu/Hurd fallback definition to include a case
for OSX. This is currently based on _APPLE_. Basing it on Darwin might
be more appropriate, but that would need to be tested.
2) Duplicates this fallback setup in netlib.c, where it was missing.
3) Adds an ifdef to gpsd.c so that other cases that fail to define
IPV6_TCLASS will simply omit the IPTOS_LOWDELAY setup, rather than
failing to build. It's not entirely clear that sweeping the problem
under the rug is preferable to getting an error and having the builder
figure out what to do, but it is consistent with netlib.c, which
includes a similar ifdef.
The patch is originally from jeremyhu@macports.org, updated for 3.14
by ryandesign@macports.org, and then updated by me for 3.16.
Diffstat (limited to 'gpsd.c')
-rw-r--r-- | gpsd.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -149,11 +149,13 @@ static struct gps_context_t context; static int sd_socket_count = 0; #endif -/* work around the unfinished ipv6 implementation on hurd */ -#ifdef __GNU__ +/* work around the unfinished ipv6 implementation on hurd and OSX <10.6 */ #ifndef IPV6_TCLASS -#define IPV6_TCLASS 61 -#endif +# if defined(__GNU__) +# define IPV6_TCLASS 61 +# elif defined(__APPLE__) +# define IPV6_TCLASS 36 +# endif #endif static volatile sig_atomic_t signalled; @@ -406,10 +408,12 @@ static socket_t passivesock_af(int af, char *service, char *tcp_or_udp, int qlen (void)close(s); return -1; } +#ifdef IPV6_TCLASS /* Set packet priority */ if (setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &dscp, sizeof(dscp)) == -1) gpsd_log(&context.errout, LOG_WARN, "Warning: SETSOCKOPT TOS failed\n"); +#endif /* IPV6_TCLASS */ } break; #endif /* IPV6_ENABLE */ |