mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: Petr Vorel <petr.vorel@gmail.com>
Cc: linux-kernel@vger.kernel.org, musl@lists.openwall.com,
	linux-api@vger.kernel.org, libc-alpha@sourceware.org,
	Peter Korsgaard <peter@korsgaard.com>,
	Florian Weimer <fweimer@redhat.com>,
	Baruch Siach <baruch@tkos.co.il>,
	"David S . Miller" <davem@davemloft.net>,
	Michal Kubecek <mkubecek@suse.cz>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [musl] [PATCH 1/1] uapi: Don't include <linux/sysinfo.h> in <linux/kernel.h>
Date: Thu, 1 Oct 2020 16:11:08 -0400	[thread overview]
Message-ID: <20201001201108.GR17637@brightrain.aerifal.cx> (raw)
In-Reply-To: <20201001195231.17226-1-petr.vorel@gmail.com>

On Thu, Oct 01, 2020 at 09:52:31PM +0200, Petr Vorel wrote:
> + update code where needed (include <linux/sysinfo.h> in code which
> included <linux/kernel.h> only to get struct sysinfo or SI_LOAD_SHIFT).
> 
> The reason is to avoid indirect <linux/sysinfo.h> include when using
> some network headers: <linux/netlink.h> or others [1] ->
> <linux/kernel.h> -> <linux/sysinfo.h>.
> 
> This indirect include causes redefinition of struct sysinfo when
> included both <sys/sysinfo.h> and some of network headers:
> 
> In file included from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:5,
>                  from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:5,
>                  from ../include/tst_netlink.h:14,
>                  from tst_crypto.c:13:
> x86_64-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:8:8: error: redefinition of ‘struct sysinfo’
>  struct sysinfo {
>         ^~~~~~~
> In file included from ../include/tst_safe_macros.h:15,
>                  from ../include/tst_test.h:93,
>                  from tst_crypto.c:11:
> x86_64-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here
> 
> [1] or <linux/sysctl.h>, <linux/ethtool.h>, <linux/mroute6.h>, <linux/ethtool.h>
> 
> Suggested-by: Rich Felker <dalias@aerifal.cx>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> Hi,
> 
> this looks to be long standing problem: python-psutil [2], iproute2 [3],
> even for glibc in the past [4] and it tried to be solved before [5].
> 
> This will require glibc fix after:

You can't do this; it breaks the existing contract with glibc. New
kernel headers can't force a glibc upgrade. You just have to get rid
of use of <linux/kernel.h> elsewhere in the uapi headers. It was a
mistake that <linux/sysinfo.h> was ever separated out of
<linux/kernel.h> since it didn't (and couldn't) fix the contract that
<linux/kernel.h> exposes struct sysinfo (and that it's misnamed). But
it's no big deal. This can all be fixed without any breakage anywhere
just by not using it.

Rich

  reply	other threads:[~2020-10-01 20:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 19:52 Petr Vorel
2020-10-01 20:11 ` Rich Felker [this message]
2020-10-01 20:27   ` Petr Vorel
2020-10-01 21:52     ` Rich Felker
2020-10-01 22:29       ` Petr Vorel

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=20201001201108.GR17637@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=baruch@tkos.co.il \
    --cc=davem@davemloft.net \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=musl@lists.openwall.com \
    --cc=peter@korsgaard.com \
    --cc=petr.vorel@gmail.com \
    --cc=stephen@networkplumber.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).