[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1519733212-30703-2-git-send-email-serhe.popovych@gmail.com>
Date: Tue, 27 Feb 2018 14:06:50 +0200
From: Serhey Popovych <serhe.popovych@...il.com>
To: netdev@...r.kernel.org
Cc: thomas.de_schampheleire@...ia.com
Subject: [PATCH iproute2 1/3] ip: Fix compilation with kernel headers < 3.4
Since commit 596b1c94aa38 ("iproute: build more easily on Android"),
iproute2 uses types __kernel_long_t and __kernel_ulong_t but does not
provide internal definitions for it.
This means that compilation using kernel headers that are older than 3.4
(where these types were added) will fail. This situation may be uncommon
for native compilation, but not uncommon for cross compilation where the
toolchains may be a bit older.
Provide the necessary types internally if not provided by the kernel
headers to fix compilation in such cases.
Co-Developed-by: Serhii Popovych <serhe.popovych@...il.com>
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@...ia.com>
Signed-off-by: Serhey Popovych <serhe.popovych@...il.com>
---
Makefile | 5 ++++-
include/compat/kernel/linux/sysinfo.h | 14 ++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 include/compat/kernel/linux/sysinfo.h
diff --git a/Makefile b/Makefile
index 32587db..c18a13f 100644
--- a/Makefile
+++ b/Makefile
@@ -54,7 +54,10 @@ CCOPTS = -O2
WFLAGS := -Wall -Wstrict-prototypes -Wmissing-prototypes
WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
-CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS)
+CCINCS := -I../include/compat/kernel -I../include/compat/libc
+CCINCS += -I../include -I../include/uapi
+
+CFLAGS := $(WFLAGS) $(CCOPTS) $(CCINCS) $(DEFINES) $(CFLAGS)
YACCFLAGS = -d -t -v
SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma man
diff --git a/include/compat/kernel/linux/sysinfo.h b/include/compat/kernel/linux/sysinfo.h
new file mode 100644
index 0000000..78fa6d7
--- /dev/null
+++ b/include/compat/kernel/linux/sysinfo.h
@@ -0,0 +1,14 @@
+#ifndef _IP_COMPAT_LINUX_SYSINFO_H
+#define _IP_COMPAT_LINUX_SYSINFO_H
+
+/* In case the kernel header asm/posix_types.h is too old (< 3.4) to provide
+ * __kernel_long_t, provide it here
+ */
+#ifndef __kernel_long_t
+typedef long __kernel_long_t;
+typedef unsigned long __kernel_ulong_t;
+#endif
+
+#include_next <linux/sysinfo.h>
+
+#endif /* _IP_COMPAT_LINUX_SYSINFO_H */
--
1.7.10.4
Powered by blists - more mailing lists