aboutsummaryrefslogtreecommitdiff
path: root/stubs/qmp-quit.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2021-10-26 11:22:24 +0100
committerAlex Bennée <alex.bennee@linaro.org>2021-11-04 10:32:01 +0000
commita00e37a4be88a043fea3e8be3ee3a85f6c4939cf (patch)
treef09dfffdd4e02dd191d2d300ab07b527ca243711 /stubs/qmp-quit.c
parentb8312e04c8116b7787c54eb6c3cfee712b74f2f3 (diff)
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 'stubs/qmp-quit.c')
-rw-r--r--stubs/qmp-quit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stubs/qmp-quit.c b/stubs/qmp-quit.c
new file mode 100644
index 0000000000..a3ff47f7bd
--- /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();
+}