From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com ([209.85.215.67]:37425 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752056AbeB0MVl (ORCPT ); Tue, 27 Feb 2018 07:21:41 -0500 Received: by mail-lf0-f67.google.com with SMTP id y19so27202363lfd.4 for ; Tue, 27 Feb 2018 04:21:40 -0800 (PST) Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 To: Thomas De Schampheleire Cc: netdev@vger.kernel.org References: <1519674401-23631-1-git-send-email-serhe.popovych@gmail.com> <20180227101624.GM8100@australia> From: Serhey Popovych Message-ID: Date: Tue, 27 Feb 2018 14:21:32 +0200 MIME-Version: 1.0 In-Reply-To: <20180227101624.GM8100@australia> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pWiY1OjxYQEDSzr6t9CxDSN9tFP5GwIv2" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pWiY1OjxYQEDSzr6t9CxDSN9tFP5GwIv2 Content-Type: multipart/mixed; boundary="avinSCHbhak45E809YWxrqeMvUgm7XIBy"; protected-headers="v1" From: Serhey Popovych To: Thomas De Schampheleire Cc: netdev@vger.kernel.org Message-ID: Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 References: <1519674401-23631-1-git-send-email-serhe.popovych@gmail.com> <20180227101624.GM8100@australia> In-Reply-To: <20180227101624.GM8100@australia> --avinSCHbhak45E809YWxrqeMvUgm7XIBy Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thomas De Schampheleire wrote: > On Mon, Feb 26, 2018 at 09:46:41PM +0200, Serhey Popovych wrote: >> Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses t= ypes >> __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= =2E4 >> (where these types were added) will fail. This situation may be uncomm= on 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 */ >=20 > Actually, I now wonder: instead of applying this trick with #include_ne= xt on > sysinfo.h, why not do it on linux/types.h ? That would be more correct = and more > robust for the future, no? No. Headers in include/uapi updated automatically from newer kernel versions. If we do any hacks in iproute2 uapi directory updating headers automatically would be problematic. As for me using #include_next presents better approach. Better to provide means for compatibility and that I propose to do with series "ip: Provide compatibility bits to build with old glibc/kernel headers". >=20 > /Thomas >=20 --avinSCHbhak45E809YWxrqeMvUgm7XIBy-- --pWiY1OjxYQEDSzr6t9CxDSN9tFP5GwIv2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAEBAgAGBQJalU1QAAoJEBTawMmQ61bBCBoH/ifAAeOyFMii9Ly9H9iGC9qg 3VOA25ikYREOVPjC5OS6Omy84IzwKuUKYdh1zdiD7EYu5hZtqlhPCwjEH1lxIwPI zqTt2z9ojhlNnXDPrqNoRcqgv0eIcWb96NKprEI8JA6p4FvEg+nD8+powwvVt7rK OflqZyI1OuVW9W6/NW253BG893hlpVjQ1XV1IAKov5QHFUmIYCZfaKccXw+/EPbO Y7pacprxr26IB4XnHGWGwbPBqasXhsyNqBmVJBZfrbnFredP8tPebscWfojSfaIK Edppr1MECYn42aS1jZJUM6peoVrrANVzE8kbkNyE+SJ/6GUp9VQepMc7Sb+mQ1A= =j73a -----END PGP SIGNATURE----- --pWiY1OjxYQEDSzr6t9CxDSN9tFP5GwIv2--