From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from port70.net (port70.net [81.7.13.123]) by sourceware.org (Postfix) with ESMTP id 52DF8383F842 for ; Wed, 3 Jun 2020 11:45:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 52DF8383F842 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=port70.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nsz@port70.net Received: by port70.net (Postfix, from userid 1002) id 3A60FABEC0C2; Wed, 3 Jun 2020 13:45:46 +0200 (CEST) Date: Wed, 3 Jun 2020 13:45:46 +0200 From: Szabolcs Nagy To: Rich Felker Cc: musl@lists.openwall.com, libc-alpha@sourceware.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: sys/sysinfo.h clash with linux/kernel.h Message-ID: <20200603114546.GA125404@port70.net> Mail-Followup-To: Rich Felker , musl@lists.openwall.com, libc-alpha@sourceware.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org References: <20200602213704.GF1079@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200602213704.GF1079@brightrain.aerifal.cx> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2020 11:45:50 -0000 i think the linux-api list is the right place for this so adding it on cc. * Rich Felker [2020-06-02 17:37:05 -0400]: > linux/kernel.h is a uapi header that does almost nothing but define > some internal-use alignment macros and -- oddly -- include > linux/sysinfo.h to provide a definition of struct sysinfo. It's > included only from 6 places in the kernel uapi headers: > > include/uapi/linux/lightnvm.h > include/uapi/linux/ethtool.h > include/uapi/linux/sysctl.h > include/uapi/linux/netlink.h > include/uapi/linux/netfilter/x_tables.h > include/uapi/linux/mroute6.h > > However, it's also included from glibc's sys/sysinfo.h to provide > struct sysinfo (glibc depends on the kernel for the definition). On > musl, this produces a conflicting definition if both sys/sysinfo.h and > any of the above 6 headers are included in the same file. > > I think the underlying problem here is that the same header is used > for two very disjoint purposes: by glibc as the provider of struct > sysinfo, and by other kernel headers as provider of the alignment > macros. > > The glibc use is effectively a permanent contract that can't be > changed, so what I'd like to do is move the macros out to a separate > header (maybe linux/something_macros.h?) and have linux/kernel.h and > the above 6 uapi headers all include that. Then nothing but > linux/kernel.h would pull in linux/sysinfo.h. i think providing a patch would make this happen faster. ideally uapi would be reorganized such that it's clear what headers are supposed to be compatible with inclusion together with libc headers and what headers may conflict. > > Note that in practice this is a rather hard issue to hit since almost > nothing needs sysinfo() at the same time as the above uapi interfaces. > However it did come up in toybox, which is how I first (just today) > learned about the conflict, so it seems like something that should be > fixed. > > Rich