From a00e37a4be88a043fea3e8be3ee3a85f6c4939cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 26 Oct 2021 11:22:24 +0100 Subject: chardev: don't exit() straight away on C-a x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reported-by: Lukas Jünger Reviewed-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Acked-by: Paolo Bonzini Message-Id: <20211026102234.3961636-19-alex.bennee@linaro.org> --- stubs/meson.build | 1 + stubs/qmp-quit.c | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 stubs/qmp-quit.c (limited to 'stubs') diff --git a/stubs/meson.build b/stubs/meson.build index f6aa3aa..71469c1 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -31,6 +31,7 @@ stub_ss.add(files('pci-bus.c')) stub_ss.add(files('qemu-timer-notify-cb.c')) stub_ss.add(files('qmp_memory_device.c')) stub_ss.add(files('qmp-command-available.c')) +stub_ss.add(files('qmp-quit.c')) stub_ss.add(files('qtest.c')) stub_ss.add(files('ram-block.c')) stub_ss.add(files('ramfb.c')) diff --git a/stubs/qmp-quit.c b/stubs/qmp-quit.c new file mode 100644 index 0000000..a3ff47f --- /dev/null +++ b/stubs/qmp-quit.c @@ -0,0 +1,8 @@ +#include "qemu/osdep.h" +#include "qapi/qapi-commands-control.h" +#include "qapi/qmp/dispatch.h" + +void qmp_quit(Error **errp) +{ + g_assert_not_reached(); +} -- cgit v1.1