From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr50137.outbound.protection.outlook.com ([40.107.5.137]:46827 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932131AbeBZUdM (ORCPT ); Mon, 26 Feb 2018 15:33:12 -0500 Date: Mon, 26 Feb 2018 21:32:58 +0100 From: Thomas De Schampheleire To: Serhey Popovych Cc: netdev@vger.kernel.org Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 Message-ID: <20180226203258.GL8100@australia> References: <1519674401-23631-1-git-send-email-serhe.popovych@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1519674401-23631-1-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Feb 26, 2018 at 09:46:41PM +0200, Serhey Popovych wrote: > Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, 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 > --- > include/linux/sysinfo.h | 14 ++++++++++++++ > misc/ss.c | 10 ++++++++++ > 2 files changed, 24 insertions(+) > create mode 100644 include/linux/sysinfo.h > > diff --git a/include/linux/sysinfo.h b/include/linux/sysinfo.h > new file mode 100644 > index 0000000..766de8d > --- /dev/null > +++ b/include/linux/sysinfo.h > @@ -0,0 +1,14 @@ > +#ifndef _SYSINFO_COMPAT_H > +#define _SYSINFO_COMPAT_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 /* _SYSINFO_COMPAT_H */ > diff --git a/misc/ss.c b/misc/ss.c > index e047f9c..de5a673 100644 > --- a/misc/ss.c > +++ b/misc/ss.c > @@ -46,6 +46,16 @@ > #include > #include > > +#ifndef AF_VSOCK > +#define AF_VSOCK 40 > +#if defined(AF_MAX) && AF_MAX < 41 > +#undef AF_MAX > +#endif > +#ifndef AF_MAX > +#define AF_MAX 41 > +#endif /* AF_MAX */ > +#endif /* AF_VSOCK */ > + > #define MAGIC_SEQ 123456 > #define BUF_CHUNK (1024 * 1024) > #define LEN_ALIGN(x) (((x) + 1) & ~1) Thanks, this patch works fine in my use case too. I can't judge the changes in ss.c. I did not see such problems, but my toolchain is based on 3.3 kernel headers. Best regards, Thomas