public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: David Miller <davem@davemloft.net>
Cc: "Asbjørn Sloth Tønnesen" <asbjorn@asbjorn.st>,
	jchapman@katalix.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uapi: fix linux/if_pppol2tp.h userspace compilation errors
Date: Tue, 14 Feb 2017 23:29:50 +0300	[thread overview]
Message-ID: <20170214202950.GB17325@altlinux.org> (raw)
In-Reply-To: <20170214.143723.629330014459224649.davem@davemloft.net>

On Tue, Feb 14, 2017 at 02:37:23PM -0500, David Miller wrote:
> From: "Dmitry V. Levin" <ldv@altlinux.org>
> Date: Tue, 14 Feb 2017 13:33:53 +0300
> 
> > In file included from /usr/include/linux/l2tp.h:12:0,
> >                  from /usr/include/linux/if_pppol2tp.h:21,
> > /usr/include/netinet/in.h:31:8: error: redefinition of 'struct in_addr'
> 
> This is protected properly by __UAPI_DEF_IN_ADDR, so whichever gets
> included first makes the definition.
> 
> This whole thing is designed so that if GLIBC headers are included
> first, __UAPI_DEF_IN_ADDR will be defined to zero, therefore
> linux/in.h won't try to make the definition.  Otherwise it will.
> 
> The facility should not be so fragile that we have to play all
> kinds of header ordering games.  We would be imposing the same
> strange rules on userspace applications including these headers
> which is completely unacceptable.

The facility is so fragile that netinet/in.h cannot be included after
linux/in.h:

$ gcc -S -o/dev/null -xc /dev/null -include /usr/include/linux/in.h -include /usr/include/netinet/in.h
In file included from <command-line>:32:0:
/usr/include/netinet/in.h:31:8: error: redefinition of 'struct in_addr'
 struct in_addr
        ^~~~~~~
In file included from <command-line>:32:0:
/usr/include/linux/in.h:84:8: note: originally defined here
 struct in_addr {
        ^~~~~~~

> So if the facility isn't working correctly, let's fix that instead
> of fidgeting with include ordering all over the tree.

I don't mind if the whole facility will get fixed someday.
My humble objective was just to fix the regression introduced in v4.10-rc1
by commit 47c3e7783be4.


-- 
ldv

  reply	other threads:[~2017-02-14 20:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 10:33 [PATCH] uapi: fix linux/if_pppol2tp.h userspace compilation errors Dmitry V. Levin
2017-02-14 19:37 ` David Miller
2017-02-14 20:29   ` Dmitry V. Levin [this message]
2017-02-15  2:23     ` [PATCH v2] " Dmitry V. Levin
2017-02-15  3:18       ` David Miller

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=20170214202950.GB17325@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=asbjorn@asbjorn.st \
    --cc=davem@davemloft.net \
    --cc=jchapman@katalix.com \
    --cc=linux-kernel@vger.kernel.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