Skip to contentSkip to conversation

linux-user: fix build with 5.2-rc2 kernel headers

PATCH In review Christian Borntraeger 2 participants 2 messages Jun 4, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: fix build with 5.2-rc2 kernel headers

Since kernel commit 0768e17073dc527ccd ("net: socket: implement 64-bit timestamps") the linux kernel headers (those installed on the build system, not those that are synced to QEMU) will make qemu-user fail to build:

/root/rpmbuild/BUILD/qemu-4.0.50/linux-user/ioctls.h:222:9: error: 'SIOCGSTAMP' undeclared here (not in a function); did you mean 'SIOCSRARP'?
222 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))

      |         ^~~~~~~~~~

Let us fix this by including "linux/sockios.h" instead of relying on "sys/socket.h" providing those defines via an include chain.

---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index efa3ec2837..7332be9b06 100644
@@ -34,6 +34,7 @@
 #include <sys/resource.h>
 #include <sys/swap.h>
 #include <linux/capability.h>
+#include <linux/sockios.h>
 #include <sched.h>
 #include <sys/timex.h>
 #include <sys/socket.h>
Signature · 1 line
2.21.0
#1 lore raw

Le 04/06/2019 à 09:19, Christian Borntraeger a écrit :

Quoted 11 lines

Since kernel commit 0768e17073dc527ccd ("net: socket: implement 64-bit timestamps") the linux kernel headers (those installed on the build system, not those that are synced to QEMU) will make qemu-user fail to build:

/root/rpmbuild/BUILD/qemu-4.0.50/linux-user/ioctls.h:222:9: error: 'SIOCGSTAMP' undeclared here (not in a function); did you mean 'SIOCSRARP'?
222 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))

      |         ^~~~~~~~~~

Let us fix this by including "linux/sockios.h" instead of relying on "sys/socket.h" providing those defines via an include chain.

I'm not sure it is as simple as this:
the value of SIOCGSTAMP depends on the size of struct timeval, and we should use SIOCGSTAMP_OLD and SIOCGSTAMP_NEW to have the host and the guest parts in sync.

Thanks,
Laurent

Quoted 23 lines
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
index efa3ec2837..7332be9b06 100644
@@ -34,6 +34,7 @@
 #include <sys/resource.h>
 #include <sys/swap.h>
 #include <linux/capability.h>
+#include <linux/sockios.h>
 #include <sched.h>
 #include <sys/timex.h>
 #include <sys/socket.h>