linuxptp: fix build with kernel headers >= 4.19
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
clockid_t has been added in net_tstamp.h since kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62f
As a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_t clockid; /* reference clockid */
To fix this error, add (or move) include on time.h before net_tstamp.h in clock.c, sk.c and timemaster.c
Fixes:
- http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066
--- .../0002-fix-build-with-kernel-headers-4.19.patch | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch
package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch new file +71 -0
@@ -0,0 +1,71 @@ +From d378524e88f6228a3fbf58641f6e0002fa9d0724 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Thu, 29 Nov 2018 22:19:19 +0100 +Subject: [PATCH] fix build with kernel headers >= 4.19 + +clockid_t has been added in net_tstamp.h since kernel 4.19 and +https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62f + +As a result, build fails on: +In file included from clock.c:20: +/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t' + clockid_t clockid; /* reference clockid */ + +To fix this error, add (or move) include on time.h before net_tstamp.h +in clock.c, sk.c and timemaster.c + +Fixes: + - http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066 + +Signed-off-by: Fabrice Fontaine <[email protected]> +[Upstream status: https://sourceforge.net/p/linuxptp/code/merge-requests/1] +--- + clock.c | 2 +- + sk.c | 1 + + timemaster.c | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/clock.c b/clock.c +index 56bc79b..ef9a008 100644 +--- a/clock.c ++++ b/clock.c +@@ -17,11 +17,11 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <poll.h> + #include <stdlib.h> + #include <string.h> +-#include <time.h> + #include <sys/queue.h> + + #include "address.h" +diff --git a/sk.c b/sk.c +index e2b1f28..30162eb 100644 +--- a/sk.c ++++ b/sk.c +@@ -18,6 +18,7 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <linux/sockios.h> + #include <linux/ethtool.h> +diff --git a/timemaster.c b/timemaster.c +index 058678f..00db59f 100644 +--- a/timemaster.c ++++ b/timemaster.c +@@ -22,6 +22,7 @@ + #include <errno.h> + #include <libgen.h> + #include <limits.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <net/if.h> + #include <signal.h> +-- +2.14.1 +
Signature · 1 line
2.14.1
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
Hi Fabrice,
Adding Richard Cochran who introduced this net_tstamp.h change in kernel commit 80b14dee2be.
Quoted 10 lines · Fabrice Fontaine
clockid_thas been added innet_tstamp.hsince kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62fAs a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_tclockid; /* reference clockid */To fix this error, add (or move) include on
time.hbeforenet_tstamp.hinclock.c,sk.candtimemaster.c
I think this is a bug in the net_tstamp.h header. UAPI headers should not reference userspace types. It should use __kernel_clockid_t instead.
Richard, can you comment on that?
Thanks,
baruch
Quoted 76 lines
Fixes:
- http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066Signed-off-by Fabrice Fontaine <[email protected]>--- .../0002-fix-build-with-kernel-headers-4.19.patch | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patchpackage/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch new file +61
-0@@ -0,0 +1,71 @@ +From d378524e88f6228a3fbf58641f6e0002fa9d0724 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Thu, 29 Nov 2018 22:19:19 +0100 +Subject: [PATCH] fix build with kernel headers >= 4.19 + +clockid_t has been added in net_tstamp.h since kernel 4.19 and +https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62f + +As a result, build fails on: +In file included from clock.c:20: +/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t' + clockid_t clockid; /* reference clockid */ + +To fix this error, add (or move) include on time.h before net_tstamp.h +in clock.c, sk.c and timemaster.c + +Fixes: + - http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066 + +Signed-off-by: Fabrice Fontaine <[email protected]> +[Upstream status: https://sourceforge.net/p/linuxptp/code/merge-requests/1] +--- + clock.c | 2 +- + sk.c | 1 + + timemaster.c | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/clock.c b/clock.c +index 56bc79b..ef9a008 100644 +--- a/clock.c ++++ b/clock.c +@@ -17,11 +17,11 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <poll.h> + #include <stdlib.h> + #include <string.h> +-#include <time.h> + #include <sys/queue.h> + + #include "address.h" +diff --git a/sk.c b/sk.c +index e2b1f28..30162eb 100644 +--- a/sk.c ++++ b/sk.c +@@ -18,6 +18,7 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <linux/sockios.h> + #include <linux/ethtool.h> +diff --git a/timemaster.c b/timemaster.c +index 058678f..00db59f 100644 +--- a/timemaster.c ++++ b/timemaster.c +@@ -22,6 +22,7 @@
package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch line 71
Quoted 10 lines
package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch new file +10
-0+ #include <errno.h> + #include <libgen.h> + #include <limits.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <net/if.h> + #include <signal.h> +-- +2.14.1 +
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
In reply to Fabrice FontaineHi Fabrice,
[ Resending with the updated address of Richard ]
Adding Richard Cochran who introduced this net_tstamp.h change in kernel commit 80b14dee2be.
Quoted 10 lines · Fabrice Fontaine
clockid_thas been added innet_tstamp.hsince kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62fAs a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_tclockid; /* reference clockid */To fix this error, add (or move) include on
time.hbeforenet_tstamp.hinclock.c,sk.candtimemaster.c
I think this is a bug in the net_tstamp.h header. UAPI headers should not reference userspace types. It should use __kernel_clockid_t instead.
Richard, can you comment on that?
Thanks,
baruch
Quoted 76 lines
Fixes:
- http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066Signed-off-by Fabrice Fontaine <[email protected]>--- .../0002-fix-build-with-kernel-headers-4.19.patch | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patchpackage/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch new file +61
-0@@ -0,0 +1,71 @@ +From d378524e88f6228a3fbf58641f6e0002fa9d0724 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Thu, 29 Nov 2018 22:19:19 +0100 +Subject: [PATCH] fix build with kernel headers >= 4.19 + +clockid_t has been added in net_tstamp.h since kernel 4.19 and +https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62f + +As a result, build fails on: +In file included from clock.c:20: +/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t' + clockid_t clockid; /* reference clockid */ + +To fix this error, add (or move) include on time.h before net_tstamp.h +in clock.c, sk.c and timemaster.c + +Fixes: + - http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066 + +Signed-off-by: Fabrice Fontaine <[email protected]> +[Upstream status: https://sourceforge.net/p/linuxptp/code/merge-requests/1] +--- + clock.c | 2 +- + sk.c | 1 + + timemaster.c | 1 + + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/clock.c b/clock.c +index 56bc79b..ef9a008 100644 +--- a/clock.c ++++ b/clock.c +@@ -17,11 +17,11 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <poll.h> + #include <stdlib.h> + #include <string.h> +-#include <time.h> + #include <sys/queue.h> + + #include "address.h" +diff --git a/sk.c b/sk.c +index e2b1f28..30162eb 100644 +--- a/sk.c ++++ b/sk.c +@@ -18,6 +18,7 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + #include <errno.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <linux/sockios.h> + #include <linux/ethtool.h> +diff --git a/timemaster.c b/timemaster.c +index 058678f..00db59f 100644 +--- a/timemaster.c ++++ b/timemaster.c +@@ -22,6 +22,7 @@
package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch line 71
Quoted 10 lines
package/linuxptp/0002-fix-build-with-kernel-headers-4.19.patch new file +10
-0+ #include <errno.h> + #include <libgen.h> + #include <limits.h> ++#include <time.h> + #include <linux/net_tstamp.h> + #include <net/if.h> + #include <signal.h> +-- +2.14.1 +
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
Hello,
Quoted 14 lines · Baruch Siach
[ Resending with the updated address of Richard ]
Adding Richard Cochran who introduced this
net_tstamp.hchange in kernel commit80b14dee2be.Quoted 8 lines · Fabrice Fontaine
clockid_thas been added innet_tstamp.hsince kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62fAs a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_tclockid; /* reference clockid */
Quoted 7 lines
Quoted 2 lines
To fix this error, add (or move) include on
time.hbeforenet_tstamp.hinclock.c,sk.candtimemaster.cI think this is a bug in the
net_tstamp.hheader. UAPI headers should not reference userspace types. It should use__kernel_clockid_tinstead.Richard, can you comment on that?
Any update on this? I agree with Baruch here, __kernel_clockid_t should be used.
However, 4.19 is already released with this clockid_t reference, so I guess we will anyway have to support that ?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
Hi Thomas,
Quoted 22 lines · Thomas Petazzoni
Quoted 20 lines · Baruch Siach
[ Resending with the updated address of Richard ]
Adding Richard Cochran who introduced this
net_tstamp.hchange in kernel commit80b14dee2be.Quoted 10 lines · Fabrice Fontaine
clockid_thas been added innet_tstamp.hsince kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62fAs a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_tclockid; /* reference clockid */To fix this error, add (or move) include on
time.hbeforenet_tstamp.hinclock.c,sk.candtimemaster.cI think this is a bug in the
net_tstamp.hheader. UAPI headers should not reference userspace types. It should use__kernel_clockid_tinstead.
Quoted 7 lines
Quoted 1 line
Richard, can you comment on that?
Any update on this? I agree with Baruch here,
__kernel_clockid_tshould be used.However, 4.19 is already released with this
clockid_treference, so I guess we will anyway have to support that ?
A patch fixing that would be backported to 4.19.x I think. So unless some external toolchain sticks to older buggy header, we can get away with that.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
A message that is not in the archive (sent off-list or not yet received): 20181210015934.ts3hvqehn2qvnlxj@localhost
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
Hello Richard,
Quoted 5 lines · Richard Cochran
Quoted 2 lines
However, 4.19 is already released with this
clockid_treference, so I guess we will anyway have to support that ?Please take this question up with Jesus Sanchez-Palencia on netdev mailing list.
Yesterday, when I replied to this thread, which has Jesus in Cc, I got:
<[email protected]>: host mga14.intel.com[192.55.52.115] said:
550 #5.1.0 Address rejected. (in reply to RCPT TO command)
So I'm not sure what's going on, but Jesus is probably not receiving all his e-mails.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 linuxptp: fix build with kernel headers >= 4.19
In reply to Fabrice FontaineHello,
Quoted 8 lines · Fabrice Fontaine
clockid_thas been added innet_tstamp.hsince kernel 4.19 and
https://github.com/torvalds/linux/commit/80b14dee2bea128928537d61c333f24cb8cbb62fAs a result, build fails on:
In file included from clock.c:20:/home/peko/autobuild/instance-0/output/host/arc-buildroot-linux-uclibc/sysroot/usr/include/linux/net_tstamp.h:158:2: error: unknown type name 'clockid_t'
clockid_tclockid; /* reference clockid */
Quoted 7 lines
To fix this error, add (or move) include on
time.hbeforenet_tstamp.hinclock.c,sk.candtimemaster.cFixes:
- http://autobuild.buildroot.org/results/4f53c0b6f3395f4d1ec0aa58f9df36c8145b1066Signed-off-by Fabrice Fontaine <[email protected]>
The issue has been fixed in the upstream Linux kernel:
This commit is part of Linux 4.20. It has a "Fixes" tag, so it should normally be backported to Linux 4.19 at some point, even though this hasn't happened yet.
So instead of doing a work around in linuxptp, we'll use the upstream Linux kernel fix.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com