From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B2DBC48BD5 for ; Tue, 25 Jun 2019 11:49:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 409A6213F2 for ; Tue, 25 Jun 2019 11:49:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731970AbfFYLt2 (ORCPT ); Tue, 25 Jun 2019 07:49:28 -0400 Received: from guitar.tcltek.co.il ([192.115.133.116]:34078 "EHLO mx.tkos.co.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726931AbfFYLt1 (ORCPT ); Tue, 25 Jun 2019 07:49:27 -0400 Received: from tarshish.tkos.co.il (unknown [10.0.8.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx.tkos.co.il (Postfix) with ESMTPS id E09AE44059C; Tue, 25 Jun 2019 14:49:25 +0300 (IDT) From: Baruch Siach To: Stephen Hemminger , Jiri Pirko Cc: netdev@vger.kernel.org, Baruch Siach , Aya Levin , Moshe Shemesh Subject: [PATCH iproute2 2/2] devlink: fix libc and kernel headers collision Date: Tue, 25 Jun 2019 14:49:05 +0300 Message-Id: <7f81026b803edcaeaca05994298118271a2f287d.1561463345.git.baruch@tkos.co.il> X-Mailer: git-send-email 2.20.1 In-Reply-To: <016aabe2639668b4710b73157ea39e8f97f7d726.1561463345.git.baruch@tkos.co.il> References: <016aabe2639668b4710b73157ea39e8f97f7d726.1561463345.git.baruch@tkos.co.il> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since commit 2f1242efe9d ("devlink: Add devlink health show command") we use the sys/sysinfo.h header for the sysinfo(2) system call. But since iproute2 carries a local version of the kernel struct sysinfo, this causes a collision with libc that do not rely on kernel defined sysinfo like musl libc: In file included from devlink.c:25:0: .../sysroot/usr/include/sys/sysinfo.h:10:8: error: redefinition of 'struct sysinfo' struct sysinfo { ^~~~~~~ In file included from ../include/uapi/linux/kernel.h:5:0, from ../include/uapi/linux/netlink.h:5, from ../include/uapi/linux/genetlink.h:6, from devlink.c:21: ../include/uapi/linux/sysinfo.h:8:8: note: originally defined here struct sysinfo { ^~~~~~~ Move the sys/sysinfo.h userspace header before kernel headers, and suppress the indirect include of linux/sysinfo.h. Cc: Aya Levin Cc: Moshe Shemesh Signed-off-by: Baruch Siach --- devlink/devlink.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devlink/devlink.c b/devlink/devlink.c index b400fab17578..2ea60d3556da 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -18,11 +18,16 @@ #include #include #include +#include +/* Suppress linux/sysinfo.h to avoid + * collision of struct sysinfo definition + * with musl libc headers + */ +#define _LINUX_SYSINFO_H #include #include #include #include -#include #include #include "SNAPSHOT.h" -- 2.20.1