netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Matthew Burgess <matthew@linuxfromscratch.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	linux-kernel@vger.kernel.org
Subject: Re: Compilation issues using netlink.h
Date: Tue, 05 Jan 2010 02:32:23 +0000	[thread overview]
Message-ID: <1262658743.26813.8.camel@localhost> (raw)
In-Reply-To: <4B37FCB3.9000800@linuxfromscratch.org>

[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]

On Mon, 2009-12-28 at 00:32 +0000, Matthew Burgess wrote:
> Hi,
> 
> The test case below simplifies a failure I see when trying to compile 
> strace using kernel headers from Linux-2.6.32.2:
> 
> #include <linux/netlink.h>
> struct sockaddr_nl nl;
> int main() {
>    return 0;
> }
> 
> $ gcc -o test test.c
> In file included from test.c:1:
> /usr/include/linux/netlink.h:34: error: expected 
> specifier-qualifier-list before 'sa_family_t'
> 
> The comment in netlink.h suggests that 'sa_family_t' is expected to be 
> found in linux/socket.h, but since commit 9c501935a3 ("net: Support 
> inclusion of <linux/socket.h> before <sys/socket.h>") that appears to 
> not be true anymore, it's now in sys/socket.h.

Right.  I'm aware of this and suggested that it should be reverted, but
David Miller reckons I was right in the first place.

> Sure enough, if I change 
> the include in netlink.h to pull in sys/socket.h instead of 
> linux/socket.h, that enables the test case (and strace) to compile 
> again, but I wasn't sure if it was really the right thing to do.

I don't think it is - that will bring in many more definitions.

There are actually a whole lot of kernel networking headers which
require sa_family_t when included by user-space code.  Until
<linux/socket.h> and <sys/socket.h> cooperate to define sa_family_t
once, you will just have to include <sys/socket.h> before kernel
networking headers.

Ben.

-- 
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption] would be
development of an easy way to factor large prime numbers. - Bill Gates

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2010-01-05  2:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28  0:32 Compilation issues using netlink.h Matthew Burgess
2010-01-05  2:32 ` Ben Hutchings [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262658743.26813.8.camel@localhost \
    --to=ben@decadent.org.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@linuxfromscratch.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).