Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200930214636.186132-1-petr.vorel@gmail.com>
Date: Wed, 30 Sep 2020 23:46:36 +0200
From: Petr Vorel <petr.vorel@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Petr Vorel <petr.vorel@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Michal Kubecek <mkubecek@...e.cz>,
	musl@...ts.openwall.com
Subject: [PATCH 1/1] linux/sysinfo.h: Add guarder for struct sysinfo

for all but glibc libc.

This fixes redefinition on MUSL which also defines struct sysinfo when
including <linux/netlink.h> (which includes <linux/sysinfo.h> via
<linux/kernel.h>) and <sys/sysinfo.h>.

glibc loads <linux/sysinfo.h> in <sys/sysinfo.h>.

Signed-off-by: Petr Vorel <petr.vorel@...il.com>
---
 include/uapi/linux/sysinfo.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/uapi/linux/sysinfo.h b/include/uapi/linux/sysinfo.h
index 435d5c23f0c0..c8ab18cd36b2 100644
--- a/include/uapi/linux/sysinfo.h
+++ b/include/uapi/linux/sysinfo.h
@@ -5,6 +5,8 @@
 #include <linux/types.h>
 
 #define SI_LOAD_SHIFT	16
+
+#if defined(__KERNEL__) || defined(__GLIBC__)
 struct sysinfo {
 	__kernel_long_t uptime;		/* Seconds since boot */
 	__kernel_ulong_t loads[3];	/* 1, 5, and 15 minute load averages */
@@ -21,5 +23,6 @@ struct sysinfo {
 	__u32 mem_unit;			/* Memory unit size in bytes */
 	char _f[20-2*sizeof(__kernel_ulong_t)-sizeof(__u32)];	/* Padding: libc5 uses this.. */
 };
+#endif
 
 #endif /* _LINUX_SYSINFO_H */
-- 
2.27.0.rc0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.