Skip to content

Commit 5989020

Browse files
k7k7Anthony Liguori
authored andcommitted
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 <[email protected]> Signed-off-by: Anthony Liguori <[email protected]>
1 parent 30d335d commit 5989020

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

qemu-char.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ static void term_exit(void)
729729
fcntl(0, F_SETFL, old_fd0_flags);
730730
}
731731

732-
static void term_init(void)
732+
static void term_init(QemuOpts *opts)
733733
{
734734
struct termios tty;
735735

@@ -742,7 +742,7 @@ static void term_init(void)
742742
tty.c_oflag |= OPOST;
743743
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
744744
/* if graphical mode, we allow Ctrl-C handling */
745-
if (display_type == DT_NOGRAPHIC)
745+
if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC))
746746
tty.c_lflag &= ~ISIG;
747747
tty.c_cflag &= ~(CSIZE|PARENB);
748748
tty.c_cflag |= CS8;
@@ -775,7 +775,7 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
775775
chr->chr_close = qemu_chr_close_stdio;
776776
qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr);
777777
stdio_nb_clients++;
778-
term_init();
778+
term_init(opts);
779779

780780
return chr;
781781
}

qemu-config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ QemuOptsList qemu_chardev_opts = {
134134
},{
135135
.name = "mux",
136136
.type = QEMU_OPT_BOOL,
137+
},{
138+
.name = "signal",
139+
.type = QEMU_OPT_BOOL,
137140
},
138141
{ /* end if list */ }
139142
},

0 commit comments

Comments
 (0)