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.
Signed-off-by: Thomas De Schampheleire <redacted>
---
include/uapi/linux/posix_types.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h
index 9a7a740b..60f3d378 100644
--- a/include/uapi/linux/posix_types.h
+++ b/include/uapi/linux/posix_types.h
@@ -35,4 +35,13 @@ typedef int __kernel_mqd_t;
#include <asm/posix_types.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;
+#endif
+#ifndef __kernel_ulong_t
+typedef unsigned long __kernel_ulong_t;
+#endif
+
#endif /* _LINUX_POSIX_TYPES_H */
--
2.16.1
On Mon, 26 Feb 2018 19:51:12 +0100
Thomas De Schampheleire [off-list ref] wrote:
quoted hunk
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.
Signed-off-by: Thomas De Schampheleire <redacted>
---
include/uapi/linux/posix_types.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h
index 9a7a740b..60f3d378 100644
--- a/include/uapi/linux/posix_types.h
+++ b/include/uapi/linux/posix_types.h
@@ -35,4 +35,13 @@ typedef int __kernel_mqd_t;
#include <asm/posix_types.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;
+#endif
+#ifndef __kernel_ulong_t
+typedef unsigned long __kernel_ulong_t;
+#endif
+
#endif /* _LINUX_POSIX_TYPES_H */
No.
The headers in uapi are automatically generated from the upstream kernel
headers. If there are places that need to have backwards compatibility,
fix it in the main iproute2 source.
On Mon, Feb 26, 2018 at 10:58:10AM -0800, Stephen Hemminger wrote:
On Mon, 26 Feb 2018 19:51:12 +0100
Thomas De Schampheleire [off-list ref] wrote:
quoted
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.
Signed-off-by: Thomas De Schampheleire <redacted>
---
include/uapi/linux/posix_types.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h
index 9a7a740b..60f3d378 100644
--- a/include/uapi/linux/posix_types.h
+++ b/include/uapi/linux/posix_types.h
@@ -35,4 +35,13 @@ typedef int __kernel_mqd_t;
#include <asm/posix_types.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;
+#endif
+#ifndef __kernel_ulong_t
+typedef unsigned long __kernel_ulong_t;
+#endif
+
#endif /* _LINUX_POSIX_TYPES_H */
No.
The headers in uapi are automatically generated from the upstream kernel
headers. If there are places that need to have backwards compatibility,
fix it in the main iproute2 source.
Thanks.
But this means modifying several iproute2 source files, essentially every file
that includes (possibly indirectly) kernel.h, because that one includes
sysinfo.h which uses the __kernel_long_t type.
How do you propose to handle this? Add a new header file in include/ to hold the
two definitions with guards like above, then include that header file
unconditionally from the required files?
Something like: include/kernel_compat.h ?
Thanks,
Thomas
Thomas De Schampheleire wrote:
Since commit 596b1c94aa38e21b7a8c8562e8b61ccb744255d2, iproute2 uses types
__kernel_long_t and __kernel_ulong_t but does not provide internal
definitions for it.
I tried one time to build with headers from 3.2 (last supported LTS at
the moment) and found that AF_VSOCK is missing. As result of defining
AF_VSOCK we need to adjust AF_MAX. Not sure this is correct at all but
this helps to build with old headers.
diff --git a/misc/ss.c b/misc/ss.c
index 49f9c49..2849bc6 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -46,6 +46,16 @@
#include <linux/sctp.h>
#include <linux/vm_sockets_diag.h>
+#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 */
quoted hunk
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.
Signed-off-by: Thomas De Schampheleire <redacted>
---
include/uapi/linux/posix_types.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/uapi/linux/posix_types.h b/include/uapi/linux/posix_types.h
index 9a7a740b..60f3d378 100644
--- a/include/uapi/linux/posix_types.h
+++ b/include/uapi/linux/posix_types.h
@@ -35,4 +35,13 @@ typedef int __kernel_mqd_t;
#include <asm/posix_types.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;
+#endif
+#ifndef __kernel_ulong_t
There is no such define. Only __kernel_long_t.
+typedef unsigned long __kernel_ulong_t;
+#endif
+
#endif /* _LINUX_POSIX_TYPES_H */