From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com ([209.85.215.67]:35279 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753260AbeBZUjL (ORCPT ); Mon, 26 Feb 2018 15:39:11 -0500 Received: by mail-lf0-f67.google.com with SMTP id 70so24238203lfw.2 for ; Mon, 26 Feb 2018 12:39:10 -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> <20180226203258.GL8100@australia> From: Serhey Popovych Message-ID: <4f043e4a-472f-5edb-47cc-695ffd9b5d2a@gmail.com> Date: Mon, 26 Feb 2018 22:38:51 +0200 MIME-Version: 1.0 In-Reply-To: <20180226203258.GL8100@australia> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="CPYzJgLpbXV8TWUd8fE7MbycCKFRc4RXG" Sender: netdev-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --CPYzJgLpbXV8TWUd8fE7MbycCKFRc4RXG Content-Type: multipart/mixed; boundary="pzSAySOPvwo0dyVKRkI2YJPj6CmlvGP61"; protected-headers="v1" From: Serhey Popovych To: Thomas De Schampheleire Cc: netdev@vger.kernel.org Message-ID: <4f043e4a-472f-5edb-47cc-695ffd9b5d2a@gmail.com> Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4 References: <1519674401-23631-1-git-send-email-serhe.popovych@gmail.com> <20180226203258.GL8100@australia> In-Reply-To: <20180226203258.GL8100@australia> --pzSAySOPvwo0dyVKRkI2YJPj6CmlvGP61 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 */ >> 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 >> =20 >> +#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) >=20 > Thanks, this patch works fine in my use case too. >=20 > 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. Well, I tested this with 3.2 kernels (oldest supported) in Debian 7 (Wheezy) environment: ss.c:294:15: error: 'AF_VSOCK' undeclared here (not in a function) ss.c:323:2: error: array index in initializer not of integer type ss.c:323:2: error: (near initialization for 'default_afs') make[1]: *** [ss.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [all] Error 2 Look at your 3.3 headers, probably they provide some redefine for AF_VSOCK. In stock linux-stable/linux-3.3.y I see no AF_VSOCK, so probably I will get same error as above (however not checked yet). >=20 > Best regards, > Thomas >=20 --pzSAySOPvwo0dyVKRkI2YJPj6CmlvGP61-- --CPYzJgLpbXV8TWUd8fE7MbycCKFRc4RXG 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) iQEcBAEBAgAGBQJalHBrAAoJEBTawMmQ61bBDhAIAIZMmK1k/GokPuG9mmApEjd6 UzE/AErBItswcxDUm+8FN3HJIvfShrGYdvwvl05XCYBWdmDFbmXeZlyf4fMazRCC 238yM2sJFyRbxlgzr0/dX3vub0nwfq7goYfrUrv6s7gRIz1e44YEsqwHAuOE35wt rxMbStJq5fVaqlelk2c8SLYDLbGTIKwz+61MHyoPo2qM/lT8PhgwSuoqTtcoXoL3 CUt3BEFDYBxaEMuNSnLty4DV8+QS2i2UrfOkaIVFz9IAfkT5AXJTkod4hZX5jZJq qO6odXxE8vLf9BzH98wZA9J41HjWUac0YuEIWv4uKQdJ8BmAENiX2zqF93p6rqk= =szqB -----END PGP SIGNATURE----- --CPYzJgLpbXV8TWUd8fE7MbycCKFRc4RXG--