Re: 2.0.x and glibc-2.0 collisions...

Philip Blundell (pjb27@cam.ac.uk)
Fri, 30 May 1997 15:53:38 +0100 (BST)


On 30 May 1997, Michael Alan Dorman wrote:

> Michael Poole <poole+@andrew.cmu.edu> writes:
> > One of the best ways I've seen to handle this is to #define
> > __STRICT_KERNEL_NAMES at the start of each source file; this keeps most of
> > the name collisions from happening. However, #include <linux/socket.h>
> > causes a hard conflict on (I believe) all the data types at the start of
> > the file.
>
> Try inserting this before <sys/socket.h> is included:
>
> #if defined(__GLIBC__)
> #define _SOCKETBITS_H
> #endif /* __GLIBC__ */
>
> I've not done this on the specific piece of code you reference, but
> I've compiled an awful lot of other networking code and it all works
> OK (well, there's some alignment issues, as I'm on an Alpha, but other
> than that...).

Ugh. No, that is the wrong fix - it suppresses the glibc definitions, not
the kernel ones. The correct answer is simply to avoid including any
<linux/> header files - if there are any that you really can't live
without (ie there is no equivalent in the glibc headers) then let me know
and we can try to work something out.

What you are doing is dangerous, because in theory (though it doesn't
happen now) the glibc interface and the kernel interface might be
different, with the libc doing the translation. In any case, the glibc
headers are generally cleaner and conform more closely with the
relevant standards.

p.