[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1312679707.2591.987.camel@deadeye>
Date: Sun, 07 Aug 2011 02:15:07 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Michel Machado <michel@...irati.com.br>
Cc: netdev@...r.kernel.org
Subject: Re: include/linux/netlink.h: problem when included by an
application
On Fri, 2011-08-05 at 17:45 -0400, Michel Machado wrote:
> Hi there,
>
> When an application includes header <linux/netlink.h> obtained with
> 'make headers_install' or from /usr/include/, it produces the following
> error:
>
> /usr/include/linux/netlink.h:31:2: error: expected
> specifier-qualifier-list before ‘sa_family_t’
Yeah, I know.
> The error doesn't come up in the kernel because
> include/linux/netlink.h has the following line:
>
> #include <linux/socket.h> /* for sa_family_t */
>
> However, <linux/socket.h> from /usr/include/ doesn't have sa_family_t
> because it's protected by an $ifdef __KERNEL__ in
> include/linux/socket.h.
Which is correct, as it would otherwise conflict with <sys/socket.h>.
Previous history:
http://thread.gmane.org/gmane.linux.debian.devel.bugs.general/622621
http://thread.gmane.org/gmane.linux.network/143380
> A workaround for an application is to include <sys/socket.h> before
> <linux/netlink.h>. However, shouldn't include/linux/netlink.h be fixed?
>
> The simplest solution that I came up was replacing sa_family_t in
> include/linux/netlink.h to 'unsigned short' as header
> include/linux/socket.h does for struct __kernel_sockaddr_storage
> available to applications.
Maybe we should do something like this in <linux/socket.h>:
typedef unsigned short __kernel_sa_family_t;
#ifdef __KERNEL__
typedef __kernel_sa_family_t sa_family_t;
#endif
and then use __kernel_sa_family_t in <linux/netlink.h>.
Ben.
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists