This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: Support for Linux transparent proxy & asm/types.h
Date: Wed, 23 Dec 1998 20:13:43 +0100
From: Andi Kleen <ak@muc.de>
Cc: libc-alpha@cygnus.com
Content-Type: text/plain; charset=us-ascii
On Wed, Dec 23, 1998 at 05:20:41PM +0100, Mark Kettenis wrote:
> On a related topic: I currently give this synopsis line for netlink
> sockets:
>
> #include <linux/netlink.h>
> nl_socket = socket(PF_NETLINK, ....);
>
> To compile that snippet on glibc systems #include
> <asm/types.h> is needed. Does glibc gurantee in future
> version that asm/types.h will continue to work?
>
> No, we can't guarantee this since Linus doesn't want to commit
> himself to keeping the Linux headers namespace clean. So
> programs that compile against glibc should not include any Linux
> headers (i.e. no #include <asm/foo.h> or #include <linux/foo.h>).
> If glibc doesn't provide a header (i.e. #include <sys/foo.h>),
> the programmer is supposed to copy the needed defenitions from
> the appropriate Linux header to a private header and use that.
You want me to suggest that in the man page? Sounds like a
horrible kludge. I'll surely not do that.
Well your code snippet defenitely doesn't work on my system, since the
2.1.130 header doesn't include <ams/types.h> anymore.
The correct code would be:
#include <sys/socket.h>
nl_socket = socket (PF_NETLINK, ....);
But if the user actually wants to do something useful with the socket
he/she probably does need some of the constants in <linux/netlink.h>.
We had a <netlink/netlink.h> for a while in glibc, but IIRC it was
dropped because the kernel headers were changing too rapidly. This
probably means that it is not worth documenting this (yet).
Mark