add support for BSD struct tcphdr in netinet/tcp.h
authorRich Felker <dalias@aerifal.cx>
Wed, 5 Feb 2014 21:55:30 +0000 (16:55 -0500)
committerRich Felker <dalias@aerifal.cx>
Wed, 5 Feb 2014 21:55:30 +0000 (16:55 -0500)
commitfdaaa68d827430caa930e4c966fa8d8a9f8f64c4
tree204e1429ecf0dfe0d88cc99b614f4baf564106ad
parentad87c2eecf70c6f2852a4908b04a6329cbebaf7d
add support for BSD struct tcphdr in netinet/tcp.h

there are two versions of this structure: the BSD version and the GNU
version. previously only the GNU version was supported. the only way
to support both simultaneously is with an anonymous union, which was a
nonstandard extension prior to C11, so some effort is made to avoid
breakage with compilers which do not support anonymous unions.

this commit is based on a patch by Timo Teräs, but with some changes.
in particular, the GNU version of the structure is not exposed unless
_GNU_SOURCE is defined; this both avoids namespace pollution and
dependency on anonymous unions in the default feature profile.
include/netinet/tcp.h