netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@iki.fi>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Zhang Shengju <zhangshengju@cmss.chinamobile.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	linux-kernel@vger.kernel.org, Jan Engelhardt <jengelh@inai.de>,
	Josh Boyer <jwboyer@fedoraproject.org>,
	Waldemar Brodkorb <mail@waldemar-brodkorb.de>,
	Gabriel Laskar <gabriel@lse.epita.fr>,
	netfilter-devel@vger.kernel.org, libc-alpha@sourceware.org,
	Rich Felker <dalias@libc.org>, nd <nd@arm.com>
Subject: Re: [PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h
Date: Mon, 25 Apr 2016 15:13:35 +0300	[thread overview]
Message-ID: <20160425121335.GL5160@lakka.kapsi.fi> (raw)
In-Reply-To: <571DFED1.1090601@arm.com>

On Mon, Apr 25, 2016 at 12:26:09PM +0100, Szabolcs Nagy wrote:
> On 24/04/16 16:45, Mikko Rapeli wrote:
> > glibc's net/if.h contains copies of definitions from linux/if.h and these
> > conflict and cause build failures if both files are included by application
> > source code. Changes in uapi headers, which fixed header file dependencies to
> > include linux/if.h when it was needed, e.g. commit 1ffad83d, made the
> > net/if.h and linux/if.h incompatibilities visible as build failures for
> > userspace applications like iproute2 and xtables-addons.
> > 
> > This patch fixes compile errors when glibc net/if.h is included before
> > linux/if.h:
> > 
> 
> there should be a way to turn the conflicting definitions
> off if a libc header is included first. (the other direction
> won't work in general because linux definitions can be wrong
> for user space.)
>
> currently the only way to avoid the conflict is to define
> __GLIBC__ and a handful of glibc include guard macros that
> are not part of any public api, so a libc implementation
> might not want to do this.
> 
> e.g. the kernel could turn off the potentially conflicting
> definitions if the libc defines __LIBC_WANTS_NO_UAPI_DEFS
> (it can use finer grain control, but there should be a
> non-glibc specific way to do this).

True. Maybe Linux kernel could allow non-glibc userspace headers to define
__UAPI_DEF's as they wish but fall back to a default 1 as in lines after:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/libc-compat.h#n118

But sometimes users run old libc's and want to use shiny features from newer
kernel and thus use kernel headers for some extra definitions to existing
libc headers and use them in system calls.

Driver specific ioctl's are a good example.

-Mikko

  reply	other threads:[~2016-04-25 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 15:45 [PATCH v2] uapi glibc compat: fix compile errors when glibc net/if.h included before linux/if.h Mikko Rapeli
2016-04-25 11:26 ` Szabolcs Nagy
2016-04-25 12:13   ` Mikko Rapeli [this message]
2016-05-09 13:59 ` Josh Boyer
2016-05-09 21:35   ` Pablo Neira Ayuso
2016-05-09 22:15     ` Mikko Rapeli
2016-05-10  1:29 ` 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=20160425121335.GL5160@lakka.kapsi.fi \
    --to=mikko.rapeli@iki.fi \
    --cc=dalias@libc.org \
    --cc=davem@davemloft.net \
    --cc=gabriel@lse.epita.fr \
    --cc=jengelh@inai.de \
    --cc=jwboyer@fedoraproject.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@waldemar-brodkorb.de \
    --cc=nd@arm.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=szabolcs.nagy@arm.com \
    --cc=zhangshengju@cmss.chinamobile.com \
    /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).