linux-user: fix to handle variably sized SIOCGSTAMP with new kernels
The SIOCGSTAMP symbol was previously defined in the asm-generic/sockios.h header file. QEMU sees that header indirectly via sys/socket.h In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115 the asm-generic/sockios.h header no longer defines SIOCGSTAMP. Instead it provides only SIOCGSTAMP_OLD, which only uses a 32-bit time_t on 32-bit architectures. The linux/sockios.h header then defines SIOCGSTAMP using either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even on 32-bit architectures To cope with this we must now convert the old and new type from the target to the host one. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Message-Id: <20190718130641.15294-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
committed by
Laurent Vivier
parent
0acd4ab849
commit
6d5d5dde9a
+19
-2
@@ -222,8 +222,25 @@
|
||||
IOCTL(SIOCGIWNAME, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_char_ifreq)))
|
||||
IOCTL(SIOCSPGRP, IOC_W, MK_PTR(TYPE_INT)) /* pid_t */
|
||||
IOCTL(SIOCGPGRP, IOC_R, MK_PTR(TYPE_INT)) /* pid_t */
|
||||
IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
|
||||
IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
|
||||
|
||||
/*
|
||||
* We can't use IOCTL_SPECIAL() because it will set
|
||||
* host_cmd to XXX_OLD and XXX_NEW and these macros
|
||||
* are not defined with kernel prior to 5.2.
|
||||
* We must set host_cmd to the same value as in target_cmd
|
||||
* otherwise the consistency check in syscall_init()
|
||||
* will trigger an error.
|
||||
* host_cmd is ignored by the do_ioctl_XXX() helpers.
|
||||
* FIXME: create a macro to define this kind of entry
|
||||
*/
|
||||
{ TARGET_SIOCGSTAMP_OLD, TARGET_SIOCGSTAMP_OLD,
|
||||
"SIOCGSTAMP_OLD", IOC_R, do_ioctl_SIOCGSTAMP },
|
||||
{ TARGET_SIOCGSTAMPNS_OLD, TARGET_SIOCGSTAMPNS_OLD,
|
||||
"SIOCGSTAMPNS_OLD", IOC_R, do_ioctl_SIOCGSTAMPNS },
|
||||
{ TARGET_SIOCGSTAMP_NEW, TARGET_SIOCGSTAMP_NEW,
|
||||
"SIOCGSTAMP_NEW", IOC_R, do_ioctl_SIOCGSTAMP },
|
||||
{ TARGET_SIOCGSTAMPNS_NEW, TARGET_SIOCGSTAMPNS_NEW,
|
||||
"SIOCGSTAMPNS_NEW", IOC_R, do_ioctl_SIOCGSTAMPNS },
|
||||
|
||||
IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
|
||||
IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(TYPE_INT))
|
||||
|
||||
Reference in New Issue
Block a user