All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: libc-alpha@sourceware.org,
	YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>,
	Cong Wang <amwang@redhat.com>, Thomas Backlund <tmb@mageia.org>,
	Eric Blake <eblake@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	libvirt-list@redhat.com, tgraf@suug.ch,
	David Miller <davem@davemloft.net>,
	schwab@suse.de, carlos@systemhalted.org
Subject: Re: Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>
Date: Wed, 16 Jan 2013 12:28:39 -0500	[thread overview]
Message-ID: <201301161228.42592.vapier@gentoo.org> (raw)
In-Reply-To: <1358356211.2923.25.camel@bwh-desktop.uk.solarflarecom.com>

[-- Attachment #1: Type: Text/Plain, Size: 2898 bytes --]

On Wednesday 16 January 2013 12:10:11 Ben Hutchings wrote:
> On Wed, 2013-01-16 at 12:04 -0500, Mike Frysinger wrote:
> > On Wednesday 16 January 2013 10:47:12 Ben Hutchings wrote:
> > > On Wed, 2013-01-16 at 23:21 +0900, YOSHIFUJI Hideaki wrote:
> > > > Cong Wang wrote:
> > > > > (Cc'ing some glibc developers...)
> > > > > 
> > > > > Hello,
> > > > > 
> > > > > In glibc source file inet/netinet/in.h and kernel source file
> > > > > include/uapi/linux/in6.h, both define struct in6_addr, and both are
> > > > > visible to user applications. Thomas reported a conflict below.
> > > > > 
> > > > > So, how can we handle this? /me is wondering why we didn't see this
> > > > > before.
> > > 
> > > [...]
> > > 
> > > > This is not a new issue.  In addition to this,
> > > > netinet/in.h also conflits with linux/in.h.
> > > > 
> > > > We might have
> > > > 
> > > >  #if !defined(__GLIBC__) || !defined(_NETINET_IN_H)
> > > >  
> > > >  #endif
> > > > 
> > > > around those conflicting definitions in uapi/linux/in{,6}.h.
> > > 
> > > This only solves half the problem, as <netinet/in.h> might be included
> > > after <linux/in.h>.  Also, not all Linux userland uses glibc.
> > 
> > certainly true, but the current expectation is that you don't mix your
> > ABIs.
> 
> Whose expectation?  Which ABIs are being mixed?

the kernel's view of the world and the C library's view of the world.  there 
is a lot of overlap, but it's the C library's job to provide a POSIX compliant 
interface (and then some).

obvious examples:
 - the stat structures are not the same and require translation
 - ptrace structures are not the same and you really need to use the C lib one
 - the readdir function is completely different

but to this specific question, if you're calling the kernel's network functions 
directly, then you need to include the kernel's headers for its definition of 
how things are passed.  if you're calling the C library's network functions, 
then use the C library's headers.

> > if you're programming with the C library API, then use the C library
> > headers. if you're banging directly on the kernel, then use the kernel
> > headers.  not saying it's a perfect solution, but it works for the vast
> > majority of use cases.
> 
> In practice most C programs for Linux will use a mixture of thinly
> wrapped system calls and higher-level APIs from the C library, and never
> really call the kernel directly (as that requires inline assembler).
> Userland programmers will work around this historical mess by tweaking
> the #include order or splitting source files.  But they shouldn't have
> to.

if you're not calling the kernel directly, why are you including the kernel 
headers ?  what is the problem people are actually trying to address here (and 
no, "i want to include both headers" is not the answer) ?
-mike

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

  reply	other threads:[~2013-01-16 17:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-13 18:38 if_bridge.h: include in6.h for struct in6_addr use Thomas Backlund
2013-01-13 20:05 ` Thomas Backlund
2013-01-14 23:57   ` [libvirt] " Eric Blake
2013-01-15 10:03     ` the patch "bridge: export multicast database via netlink" broke kernel 3.8 uapi (was: Re: [libvirt] if_bridge.h: include in6.h for struct in6_addr use) Thomas Backlund
2013-01-15 10:03       ` [libvirt] the patch "bridge: export multicast database via netlink" broke kernel 3.8 uapi (was: " Thomas Backlund
2013-01-15 10:11       ` the patch "bridge: export multicast database via netlink" broke kernel 3.8 uapi (was: Re: [libvirt] " Cong Wang
2013-01-15 10:55         ` the patch "bridge: export multicast database via netlink" broke kernel 3.8 uapi Thomas Backlund
2013-01-16  5:51           ` Cong Wang
2013-01-16  6:06           ` Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h> Cong Wang
2013-01-16 14:21             ` YOSHIFUJI Hideaki
2013-01-16 15:47               ` Ben Hutchings
2013-01-16 17:04                 ` Mike Frysinger
2013-01-16 17:10                   ` Ben Hutchings
2013-01-16 17:28                     ` Mike Frysinger [this message]
2013-01-16 18:59                       ` David Miller
2013-01-16 19:22                         ` Mike Frysinger
2013-01-16 19:25                           ` David Miller
2013-01-17  3:40                           ` Cong Wang
2013-01-17  3:55                         ` [libvirt] " Jike Song
2013-01-17  6:59                           ` Cong Wang
2013-01-17  7:02                             ` Cong Wang
2013-01-16 18:57                   ` David Miller
2013-01-16 19:29                     ` Mike Frysinger
2013-01-17  2:15                     ` Carlos O'Donell
2013-01-17  3:10                       ` YOSHIFUJI Hideaki
2013-01-17  3:15                       ` David Miller
2013-01-18  4:20                         ` Mike Frysinger
2013-01-18  4:22                           ` Carlos O'Donell
2013-01-18  4:34                             ` Mike Frysinger
2013-01-18 10:44                             ` Pedro Alves
2013-01-18 13:35                               ` Carlos O'Donell
2013-01-18 14:24                                 ` YOSHIFUJI Hideaki
2013-01-18 14:36                                   ` Pedro Alves
2013-01-18 14:54                                     ` Carlos O'Donell
2013-01-21  0:54                                     ` Mike Frysinger
2013-01-17  3:22                       ` YOSHIFUJI Hideaki
2013-01-18  4:13                         ` Carlos O'Donell
2013-01-16 21:45                 ` David Miller
2013-01-17  1:58                   ` Carlos O'Donell
2013-01-17  2:05                     ` David Miller
2013-01-17 10:57                       ` Jan Engelhardt
2013-01-18  4:14                   ` Mike Frysinger
2013-01-18  4:55                     ` David Miller
2013-01-18  5:27                       ` Mike Frysinger
2013-03-13 15:17     ` [libvirt] if_bridge.h: include in6.h for struct in6_addr use Kumar Gala
2013-03-13 16:24       ` Eric Blake

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=201301161228.42592.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=amwang@redhat.com \
    --cc=bhutchings@solarflare.com \
    --cc=carlos@systemhalted.org \
    --cc=davem@davemloft.net \
    --cc=eblake@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=libvirt-list@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=schwab@suse.de \
    --cc=tgraf@suug.ch \
    --cc=tmb@mageia.org \
    --cc=yoshfuji@linux-ipv6.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.