Thread (24 messages) 24 messages, 7 authors, 2011-08-09

include/linux/netlink.h: problem when included by an application

From: Michel Machado <hidden>
Date: 2011-08-05 22:14:02

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’

   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.

   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.

-- 
[ ]'s
Michel Machado


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help