On Sat, Nov 20, 2010 at 9:10 AM, Ted Unangst <ted.unan...@gmail.com> wrote:
> On Sat, Nov 20, 2010 at 11:54 AM, Ted Unangst <ted.unan...@gmail.com>
wrote:
>> On Sat, Nov 20, 2010 at 9:18 AM, Mark Kettenis <mark.kette...@xs4all.nl>
> wrote:
>>>>  openbsd is apparently among the last operating systems to require
>>>>  sys/types.h before sys/socket.h.  posix doesn't require this and it
runs
>>>>  contrary to current recommendations i think, so it's just one more
weird
>>>>  thing to deal with when trying to get something to compile.
>>>>
>>>>  i haven't really tested this, i'm just throwing it out there.
>>>
>>> Sorry, but blindly including <sys/types.h> isn't allowed by POSIX.
>>
>> Requiring everyone to include sys/types.h before socket.h isn't
>> allowed by posix either.  This way, at least the code compiles without
>> changes.
>>
>> our socket.h header is broken.  this makes it better.

IMO, this takes it from "not enough", right past "good", to "too much"...


> By, the way, there's this comment in types.h:
>
>  * XPG4.2 states that inclusion of <netinet/in.h> must pull these
>  * in and that inclusion of <sys/socket.h> must pull in sa_family_t.
>  * We put these here because there are other headers that require
>  * these types and <sys/socket.h> and <netinet/in.h> will indirectly
>  * include <sys/types.h>.
>
> So somebody already thinks socket.h includes types.h.

The next line of that comment is interesting:

> * XXX - now that we have protected versions these should move.

Why not do what that suggests and move the sa_family_t and socklen_t
types to socket.h?  Copy the #ifndef...#endif blocks for ssize_t and
size_t there at the same time, add includes of <sys/cdefs.h> and
<sys/_types.h> and give compilation a whirl...


Philip Guenther

Reply via email to