qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-5.2 1/2] virtio host input: use safe 64-bit time accessors for input_event
@ 2020-07-22  8:52 Ariadne Conill
  2020-07-22  8:52 ` [PATCH-for-5.2 2/2] virtio user " Ariadne Conill
  0 siblings, 1 reply; 2+ messages in thread
From: Ariadne Conill @ 2020-07-22  8:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ariadne Conill

On 32-bit systems with 64-bit time_t, input_event.time is not
directly accessible.  Instead, we must use input_event_sec and
input_event_usec accessors to set the time values.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
---
 hw/input/virtio-input-host.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c
index 85daf73f1a..7b81bf09f5 100644
--- a/hw/input/virtio-input-host.c
+++ b/hw/input/virtio-input-host.c
@@ -193,13 +193,16 @@ static void virtio_input_host_handle_status(VirtIOInput *vinput,
 {
     VirtIOInputHost *vih = VIRTIO_INPUT_HOST(vinput);
     struct input_event evdev;
+    struct timeval tv;
     int rc;
 
-    if (gettimeofday(&evdev.time, NULL)) {
+    if (gettimeofday(&tv, NULL)) {
         perror("virtio_input_host_handle_status: gettimeofday");
         return;
     }
 
+    evdev.input_event_sec = tv.tv_sec;
+    evdev.input_event_usec = tv.tv_usec;
     evdev.type = le16_to_cpu(event->type);
     evdev.code = le16_to_cpu(event->code);
     evdev.value = le32_to_cpu(event->value);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH-for-5.2 2/2] virtio user input: use safe 64-bit time accessors for input_event
  2020-07-22  8:52 [PATCH-for-5.2 1/2] virtio host input: use safe 64-bit time accessors for input_event Ariadne Conill
@ 2020-07-22  8:52 ` Ariadne Conill
  0 siblings, 0 replies; 2+ messages in thread
From: Ariadne Conill @ 2020-07-22  8:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ariadne Conill

On 32-bit systems with 64-bit time_t, input_event.time is not
directly accessible.  Instead, we must use input_event_sec and
input_event_usec accessors to set the time values.

Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
---
 contrib/vhost-user-input/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/vhost-user-input/main.c b/contrib/vhost-user-input/main.c
index 6020c6f33a..4887a6cb44 100644
--- a/contrib/vhost-user-input/main.c
+++ b/contrib/vhost-user-input/main.c
@@ -115,13 +115,16 @@ vi_evdev_watch(VuDev *dev, int condition, void *data)
 static void vi_handle_status(VuInput *vi, virtio_input_event *event)
 {
     struct input_event evdev;
+    struct timeval tv;
     int rc;
 
-    if (gettimeofday(&evdev.time, NULL)) {
+    if (gettimeofday(&tv, NULL)) {
         perror("vi_handle_status: gettimeofday");
         return;
     }
 
+    evdev.input_event_sec = tv.tv_sec;
+    evdev.input_event_usec = tv.tv_usec;
     evdev.type = le16toh(event->type);
     evdev.code = le16toh(event->code);
     evdev.value = le32toh(event->value);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-22  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-22  8:52 [PATCH-for-5.2 1/2] virtio host input: use safe 64-bit time accessors for input_event Ariadne Conill
2020-07-22  8:52 ` [PATCH-for-5.2 2/2] virtio user " Ariadne Conill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).