From: Serhey Popovych <serhe.popovych@gmail.com>
To: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] Fix compilation with kernel headers < 3.4
Date: Tue, 27 Feb 2018 14:21:32 +0200 [thread overview]
Message-ID: <f43312d5-1c22-71fe-7c47-a5eb1cf19d09@gmail.com> (raw)
In-Reply-To: <20180227101624.GM8100@australia>
[-- Attachment #1.1: Type: text/plain, Size: 2292 bytes --]
Thomas De Schampheleire wrote:
> 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 <serhe.popovych@gmail.com>
>> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>> Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
>> ---
>> 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 <linux/sysinfo.h>
>> +
>> +#endif /* _SYSINFO_COMPAT_H */
>
> Actually, I now wonder: instead of applying this trick with #include_next 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".
>
> /Thomas
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
next prev parent reply other threads:[~2018-02-27 12:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-26 19:46 [PATCH iproute2] Fix compilation with kernel headers < 3.4 Serhey Popovych
2018-02-26 19:48 ` Serhey Popovych
2018-02-26 20:32 ` Thomas De Schampheleire
2018-02-26 20:38 ` Serhey Popovych
2018-02-27 10:16 ` Thomas De Schampheleire
2018-02-27 12:21 ` Serhey Popovych [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-02-26 18:51 Thomas De Schampheleire
2018-02-26 18:58 ` Stephen Hemminger
2018-02-26 19:21 ` Thomas De Schampheleire
2018-02-26 19:27 ` Serhey Popovych
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f43312d5-1c22-71fe-7c47-a5eb1cf19d09@gmail.com \
--to=serhe.popovych@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=thomas.de_schampheleire@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).