linux-user: fix includes to find SIOCGSTAMP with latest kernel headers
PATCH 1/1 linux-user: fix includes to find SIOCGSTAMP with latest kernel headers
The SIOCGSTAMP symbol was previously defined in the asm-generic/sockios.h header file. QEMU sees that header indirectly via
sys/socket.h
-> bits/socket.h
-> asm/socket.h
-> asm-generic/socket.h
-> asm/sockios.h
-> asm-generic/sockios.hIn linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115 the asm-generic/sockios.h header no longer defines SIOCGSTAMP. Instead it provides only SIOCGSTAMP_OLD.
The linux/sockios.h header now defines SIOCGSTAMP using either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. This linux only header file is not pulled in by QEMU though, so we get a build failure:
qemu/linux-user/ioctls.h:225:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
225 | IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
| ^~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | { TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
| ^~~qemu/linux-user/ioctls.h:226:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
226 | IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
| ^~~~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | { TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
| ^~~
--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)
linux-user/syscall.c +1 -0
@@ -37,6 +37,7 @@#include <sched.h> #include <sys/timex.h> #include <sys/socket.h> +#include <linux/sockios.h> #include <sys/un.h> #include <sys/uio.h> #include <poll.h>
Signature · 1 line
2.21.0
Le 17/06/2019 à 13:40, Daniel P. Berrangé a écrit :
Quoted 44 lines
The SIOCGSTAMP symbol was previously defined in the
asm-generic/sockios.hheader file. QEMU sees that header indirectly viasys/socket.h -> bits/socket.h -> asm/socket.h -> asm-generic/socket.h -> asm/sockios.h -> asm-generic/sockios.hIn linux kernel commit
0768e17073dc527ccd18ed5f96ce85f9985e9115theasm-generic/sockios.hheader no longer defines SIOCGSTAMP. Instead it provides onlySIOCGSTAMP_OLD.The
linux/sockios.hheader now defines SIOCGSTAMP using eitherSIOCGSTAMP_OLDorSIOCGSTAMP_NEWas appropriate. This linux only header file is not pulled in by QEMU though, so we get a build failure:
qemu/linux-user/ioctls.h:225:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
225 |IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))| ^~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | {TARGET_## cmd, cmd, #cmd, access, 0, {__VA_ARGS__} },
| ^~~qemu/linux-user/ioctls.h:226:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
226 |IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))| ^~~~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | {TARGET_## cmd, cmd, #cmd, access, 0, {__VA_ARGS__} },
| ^~~Signed-off-by Daniel P. Berrangé <[email protected]>--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)linux-user/syscall.c +0
-0
linux-user/syscall.c line 43
Quoted 7 lines
linux-user/syscall.c +1
-0@@ -37,6 +37,7 @@#include <sched.h> #include <sys/timex.h> #include <sys/socket.h> +#include <linux/sockios.h> #include <sys/un.h> #include <sys/uio.h> #include <poll.h>
We already had a patch for that:
https://patchew.org/QEMU/[email protected]/
but the value of SIOCGSTAMP depends on the size of struct timeval. The host part must be able to process SIOCGSTAMP_OLD and SIOCGSTAMP_NEW if it defines them.
Thanks,
Laurent
Quoted 55 lines · Laurent Vivier
Le 17/06/2019 à 13:40, Daniel P. Berrangé a écrit :
Quoted 44 lines
The SIOCGSTAMP symbol was previously defined in the
asm-generic/sockios.hheader file. QEMU sees that header indirectly viasys/socket.h -> bits/socket.h -> asm/socket.h -> asm-generic/socket.h -> asm/sockios.h -> asm-generic/sockios.hIn linux kernel commit
0768e17073dc527ccd18ed5f96ce85f9985e9115theasm-generic/sockios.hheader no longer defines SIOCGSTAMP. Instead it provides onlySIOCGSTAMP_OLD.The
linux/sockios.hheader now defines SIOCGSTAMP using eitherSIOCGSTAMP_OLDorSIOCGSTAMP_NEWas appropriate. This linux only header file is not pulled in by QEMU though, so we get a build failure:
qemu/linux-user/ioctls.h:225:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
225 |IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))| ^~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | {TARGET_## cmd, cmd, #cmd, access, 0, {__VA_ARGS__} },
| ^~~qemu/linux-user/ioctls.h:226:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
226 |IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))| ^~~~~~~~~~~~
qemu/linux-user/syscall.c:4855:23: note: in definition of macro ‘IOCTL’
4855 | {TARGET_## cmd, cmd, #cmd, access, 0, {__VA_ARGS__} },
| ^~~Signed-off-by Daniel P. Berrangé <[email protected]>--- linux-user/syscall.c | 1 + 1 file changed, 1 insertion(+)linux-user/syscall.c +0
-0linux-user/syscall.c line 43
Quoted 7 lines
linux-user/syscall.c +1
-0@@ -37,6 +37,7 @@#include <sched.h> #include <sys/timex.h> #include <sys/socket.h> +#include <linux/sockios.h> #include <sys/un.h> #include <sys/uio.h> #include <poll.h> We already had a patch for that:
Quoted 5 lines
https://patchew.org/QEMU/[email protected]/
but the value of SIOCGSTAMP depends on the size of struct timeval. The host part must be able to process
SIOCGSTAMP_OLDandSIOCGSTAMP_NEWif it defines them.
I've sent a v2 that attempts to handle both struct sizes
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|