On 05/05/2023 14.00, Claudio Imbrenda wrote:
Add new -run-with option with an async-teardown=on|off parameter. It is
visible in the output of query-command-line-options QMP command, so it
can be discovered and used by libvirt.
The option -async-teardown is now redundant, deprecate it.
...
diff --git a/os-posix.c b/os-posix.c
index 5adc69f560..ef910aaf94 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -36,6 +36,8 @@
#include "qemu/log.h"
#include "sysemu/runstate.h"
#include "qemu/cutils.h"
+#include "qemu/config-file.h"
+#include "qemu/option.h"
#ifdef CONFIG_LINUX
#include <sys/prctl.h>
@@ -152,9 +154,20 @@ int os_parse_cmd_args(int index, const char *optarg)
daemonize = 1;
break;
#if defined(CONFIG_LINUX)
+ /* deprecated */
case QEMU_OPTION_asyncteardown:
init_async_teardown();
break;
+ case QEMU_OPTION_run_with:
+ QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
+ optarg, false);
+ if (!opts) {
+ exit(1);
+ }
+ if (qemu_opt_get_bool(opts, "async-teardown", false)) {
+ init_async_teardown();
+ }
+ break;
#endif
This is causing now a compiler error with GCC 8.5 here:
../../devel/qemu/os-posix.c: In function ‘os_parse_cmd_args’:
../../devel/qemu/os-posix.c:162:9: error: a label can only be part
of a statement and a declaration is not a statement
QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
^~~~~~~~
I'll fix it up by adding some curly braces on top, no need to resend:
diff --git a/os-posix.c b/os-posix.c
--- a/os-posix.c
+++ b/os-posix.c
@@ -158,7 +158,7 @@ int os_parse_cmd_args(int index, const char *optarg)
case QEMU_OPTION_asyncteardown:
init_async_teardown();
break;
- case QEMU_OPTION_run_with:
+ case QEMU_OPTION_run_with: {
QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("run-with"),
optarg, false);
if (!opts) {
@@ -168,6 +168,7 @@ int os_parse_cmd_args(int index, const char *optarg)
init_async_teardown();
}
break;
+ }
#endif
default:
return -1;
Thomas