summaryrefslogtreecommitdiffstats
path: root/chardev
diff options
context:
space:
mode:
authorAlex Bennée2021-10-26 12:22:24 +0200
committerAlex Bennée2021-11-04 11:32:01 +0100
commita00e37a4be88a043fea3e8be3ee3a85f6c4939cf (patch)
treef09dfffdd4e02dd191d2d300ab07b527ca243711 /chardev
parentdocs/tcg-plugins: add L2 arguments to cache docs (diff)
downloadqemu-a00e37a4be88a043fea3e8be3ee3a85f6c4939cf.tar.gz
qemu-a00e37a4be88a043fea3e8be3ee3a85f6c4939cf.tar.xz
qemu-a00e37a4be88a043fea3e8be3ee3a85f6c4939cf.zip
chardev: don't exit() straight away on C-a x
While there are a number of uses in the code-base of the exit(0) pattern it gets in the way of clean exit which can do all of it's house-keeping. In particular it was reported that you can crash plugins this way because TCG can still be running on other threads when the atexit callback is called. Use qmp_quit() instead which takes care of some housekeeping before triggering the shutdown. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reported-by: Lukas Jünger <lukas.junger@greensocs.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20211026102234.3961636-19-alex.bennee@linaro.org>
Diffstat (limited to 'chardev')
-rw-r--r--chardev/char-mux.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index ada0c6866f..ee2d47b20d 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -28,6 +28,7 @@
#include "qemu/option.h"
#include "chardev/char.h"
#include "sysemu/block-backend.h"
+#include "qapi/qapi-commands-control.h"
#include "chardev-internal.h"
/* MUX driver for serial I/O splitting */
@@ -157,7 +158,7 @@ static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
{
const char *term = "QEMU: Terminated\n\r";
qemu_chr_write_all(chr, (uint8_t *)term, strlen(term));
- exit(0);
+ qmp_quit(NULL);
break;
}
case 's':