Add chardev option to disable signal.

If I am using vga and serial which is stdio and hit C-c on
serial console, qemu terminates. That is annoying for me.
So make it configurable whether signal is generated when C-c is hit.

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Kusanagi Kouichi 2009-10-16 22:31:38 +09:00 committed by Anthony Liguori
parent 30d335d68d
commit 5989020bc1
2 changed files with 6 additions and 3 deletions

View File

@ -729,7 +729,7 @@ static void term_exit(void)
fcntl(0, F_SETFL, old_fd0_flags); fcntl(0, F_SETFL, old_fd0_flags);
} }
static void term_init(void) static void term_init(QemuOpts *opts)
{ {
struct termios tty; struct termios tty;
@ -742,7 +742,7 @@ static void term_init(void)
tty.c_oflag |= OPOST; tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
/* if graphical mode, we allow Ctrl-C handling */ /* if graphical mode, we allow Ctrl-C handling */
if (display_type == DT_NOGRAPHIC) if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC))
tty.c_lflag &= ~ISIG; tty.c_lflag &= ~ISIG;
tty.c_cflag &= ~(CSIZE|PARENB); tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8; tty.c_cflag |= CS8;
@ -775,7 +775,7 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
chr->chr_close = qemu_chr_close_stdio; chr->chr_close = qemu_chr_close_stdio;
qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);
stdio_nb_clients++; stdio_nb_clients++;
term_init(); term_init(opts);
return chr; return chr;
} }

View File

@ -134,6 +134,9 @@ QemuOptsList qemu_chardev_opts = {
},{ },{
.name = "mux", .name = "mux",
.type = QEMU_OPT_BOOL, .type = QEMU_OPT_BOOL,
},{
.name = "signal",
.type = QEMU_OPT_BOOL,
}, },
{ /* end if list */ } { /* end if list */ }
}, },