netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] devlink: fix libc and kernel headers collision
@ 2019-05-30 15:32 Baruch Siach
  2019-06-03  5:58 ` Jiri Pirko
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Baruch Siach @ 2019-05-30 15:32 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, Baruch Siach, Aya Levin, Moshe Shemesh

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 {
		^~~~~~~

Rely on the kernel header alone to avoid kernel and userspace headers
collision of definitions.

Cc: Aya Levin <ayal@mellanox.com>
Cc: Moshe Shemesh <moshe@mellanox.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 devlink/devlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 436935f88bda..d7a6ce94f0e6 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -22,7 +22,7 @@
 #include <linux/devlink.h>
 #include <libmnl/libmnl.h>
 #include <netinet/ether.h>
-#include <sys/sysinfo.h>
+#include <linux/sysinfo.h>
 #include <sys/queue.h>
 
 #include "SNAPSHOT.h"
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-04 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 15:32 [PATCH] devlink: fix libc and kernel headers collision Baruch Siach
2019-06-03  5:58 ` Jiri Pirko
2019-06-03  9:02 ` Petr Vorel
2019-06-04 16:45 ` Stephen Hemminger
2019-06-04 16:47 ` Stephen Hemminger
2019-06-04 17:47   ` Baruch Siach

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