qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 3/3] s390x: Avoid hanging SCLP ASCII console


From: Heinz Graalfs
Subject: [Qemu-devel] [RFC 3/3] s390x: Avoid hanging SCLP ASCII console
Date: Fri, 24 Oct 2014 10:13:47 +0200

Exploit the new can_read timeout infrastructure in order to avoid
hangs when no further activity happens on the main thread.

Signed-off-by: Heinz Graalfs <address@hidden>
---
 hw/char/sclpconsole.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index fca105d..a33aaa2 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -44,8 +44,13 @@ typedef struct SCLPConsole {
 static int chr_can_read(void *opaque)
 {
     SCLPConsole *scon = opaque;
+    int avail = SIZE_BUFFER_VT220 - scon->iov_data_len;
 
-    return SIZE_BUFFER_VT220 - scon->iov_data_len;
+    if (avail > 0) {
+        return avail;
+    }
+
+    return -EAGAIN;
 }
 
 /* Send data from a char device over to the guest */
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]