From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com ([209.85.215.67]:37273 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbeB0MHK (ORCPT ); Tue, 27 Feb 2018 07:07:10 -0500 Received: by mail-lf0-f67.google.com with SMTP id y19so27138533lfd.4 for ; Tue, 27 Feb 2018 04:07:10 -0800 (PST) From: Serhey Popovych To: netdev@vger.kernel.org Cc: thomas.de_schampheleire@nokia.com Subject: [PATCH iproute2 1/3] ip: Fix compilation with kernel headers < 3.4 Date: Tue, 27 Feb 2018 14:06:50 +0200 Message-Id: <1519733212-30703-2-git-send-email-serhe.popovych@gmail.com> In-Reply-To: <1519733212-30703-1-git-send-email-serhe.popovych@gmail.com> References: <1519733212-30703-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 Signed-off-by: Thomas De Schampheleire Signed-off-by: Serhey Popovych --- 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 + +#endif /* _IP_COMPAT_LINUX_SYSINFO_H */ -- 1.7.10.4