Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp5181ybg; Tue, 2 Jun 2020 14:39:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr2CZA99WOwTCEK6oSvWN8lacCNigT1wmgeId8zs2KFOp8UaPDiBS/lj8vVXEUsv020Leo X-Received: by 2002:a17:906:2bd8:: with SMTP id n24mr13496746ejg.83.1591133971933; Tue, 02 Jun 2020 14:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591133971; cv=none; d=google.com; s=arc-20160816; b=ZkOZCqfqvUYWEDZE17LJnmR18gcuA5OzW+KwHQoZMir4xkcMXrkZ0CBLP1Mn06iLn3 E1o8G0YNhH2pcwwYnSibxH6yn58bZb8MgaU9G6iYbXTHr+TfgS6RzJedmpF8xYd/hs02 06Ixf6Q3NpZf+HXO3DIIoqD4X0X5PVB7skvQzuRsSHLurEQgqt5An5oxxs7TwoRRdePS ycMJaYwDg2a/P8K43cSEzWEkuZWJf0z1jaaG64WQigEEsOVkncKNpklHnuKmDdu81yfe WD5hPFHkpWn//ndGZ7j4c9aHhUXdu7N91oUJwFWLNpFHocNPMDfdw83U/BbtfjBmF4uM VELw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=zWOWTikUgo/t1W1xZmwki/vPl0lojUTYQKQg/Lp24W8=; b=RegBmbuyn70+xjzdgb5yrZ4E8F76VMeWxf9Q1daB2mgTHp9WFCFRJtWE54q8cVTpX0 xPn6GMX7PgQHRE/AmSrmwocHQ9vH/TepHpkCvNTaxZ8dAAUjiYkhB4S22KrACe15rt5q AqkM1ATdmRsKxD79KYH/oT92MuyA+vQHjaBjRcKQX82+scYxuE71hI+w/JM1huFe5G/Y nJoba1MARtm79Z5rHy2vAUCQ91riU5lKWDgl9FtAKzb4EGv4lkJMYUOcZL7SyGFkCwV9 jKhZVDiLFXKokj6vxmcsL5ttl0W5an6UQWGRVBR8w31tx4mlfAx09G2wu+yDjbc5YXkv XKRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si65221ejc.469.2020.06.02.14.39.08; Tue, 02 Jun 2020 14:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727046AbgFBVhK (ORCPT + 99 others); Tue, 2 Jun 2020 17:37:10 -0400 Received: from brightrain.aerifal.cx ([216.12.86.13]:38240 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbgFBVhJ (ORCPT ); Tue, 2 Jun 2020 17:37:09 -0400 Date: Tue, 2 Jun 2020 17:37:05 -0400 From: Rich Felker To: musl@lists.openwall.com Cc: libc-alpha@sourceware.org, linux-kernel@vger.kernel.org Subject: sys/sysinfo.h clash with linux/kernel.h Message-ID: <20200602213704.GF1079@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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