]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
curses: don't initialize curses when qemu is daemonized
authorHitoshi Mitake <h.mitake@gmail.com>
Fri, 14 Sep 2012 16:15:41 +0000 (01:15 +0900)
committerStefan Hajnoczi <stefanha@gmail.com>
Sun, 23 Sep 2012 06:11:28 +0000 (07:11 +0100)
Current qemu initializes curses even if -daemonize option is
passed. This cause problem because shell prompt appears without
calling endwin().

This patch adds new function, is_daemonized(), to OS dependent
code. With this function, curses_display_init() can check that qemu is
daemonized or not. If daemonized, curses_display_init() isn't called
and the problem is avoided.

Of course, -daemonize && -curses doesn't make sense. Users shouldn't
pass the arguments at the same time. But the problem is very painful
because Ctrl-C cannot be delivered to the terminal.

Cc: Andrzej Zaborowski <balrog@zabor.org>
Cc: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
os-posix.c
qemu-os-posix.h
qemu-os-win32.h
vl.c

index 79fa2288e486d85888ef41136cef019b46de4257..eabccb8fe051c79bfd8764d4e514d22520d744e5 100644 (file)
@@ -360,3 +360,8 @@ int qemu_create_pidfile(const char *filename)
     /* keep pidfile open & locked forever */
     return 0;
 }
+
+bool is_daemonized(void)
+{
+    return daemonize;
+}
index 8e1149d9640cde3735aa5c26fb6849acb9d6e6c4..7f198e475cda10dad36804d68e9bf2a2169804f4 100644 (file)
@@ -46,4 +46,6 @@ typedef struct timeval qemu_timeval;
 typedef struct timespec qemu_timespec;
 int qemu_utimens(const char *path, const qemu_timespec *times);
 
+bool is_daemonized(void);
+
 #endif
index 753679b194642ca544a378f68dabea2b663b9605..b3e451b71932081828510188009908d0a6e5aa7b 100644 (file)
@@ -86,4 +86,9 @@ typedef struct {
 } qemu_timeval;
 int qemu_gettimeofday(qemu_timeval *tp);
 
+static inline bool is_daemonized(void)
+{
+    return false;
+}
+
 #endif
diff --git a/vl.c b/vl.c
index 7c577fa54474e631aa926b473df1d46b9db7ab15..48049ef0b6a97080bd290216a5cf417b900ff0f0 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -3657,7 +3657,9 @@ int main(int argc, char **argv, char **envp)
         break;
 #if defined(CONFIG_CURSES)
     case DT_CURSES:
-        curses_display_init(ds, full_screen);
+        if (!is_daemonized()) {
+            curses_display_init(ds, full_screen);
+        }
         break;
 #endif
 #if defined(CONFIG_SDL)