mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 21:33:40 +08:00
curses: don't initialize curses when qemu is daemonized
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>
This commit is contained in:
parent
d8f8a860f2
commit
995ee2bf46
@ -360,3 +360,8 @@ int qemu_create_pidfile(const char *filename)
|
|||||||
/* keep pidfile open & locked forever */
|
/* keep pidfile open & locked forever */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_daemonized(void)
|
||||||
|
{
|
||||||
|
return daemonize;
|
||||||
|
}
|
||||||
|
@ -46,4 +46,6 @@ typedef struct timeval qemu_timeval;
|
|||||||
typedef struct timespec qemu_timespec;
|
typedef struct timespec qemu_timespec;
|
||||||
int qemu_utimens(const char *path, const qemu_timespec *times);
|
int qemu_utimens(const char *path, const qemu_timespec *times);
|
||||||
|
|
||||||
|
bool is_daemonized(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,4 +86,9 @@ typedef struct {
|
|||||||
} qemu_timeval;
|
} qemu_timeval;
|
||||||
int qemu_gettimeofday(qemu_timeval *tp);
|
int qemu_gettimeofday(qemu_timeval *tp);
|
||||||
|
|
||||||
|
static inline bool is_daemonized(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
4
vl.c
4
vl.c
@ -3657,7 +3657,9 @@ int main(int argc, char **argv, char **envp)
|
|||||||
break;
|
break;
|
||||||
#if defined(CONFIG_CURSES)
|
#if defined(CONFIG_CURSES)
|
||||||
case DT_CURSES:
|
case DT_CURSES:
|
||||||
curses_display_init(ds, full_screen);
|
if (!is_daemonized()) {
|
||||||
|
curses_display_init(ds, full_screen);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_SDL)
|
#if defined(CONFIG_SDL)
|
||||||
|
Loading…
Reference in New Issue
Block a user