[PATCH v3 27/49] monitor: reject readline monitor when HMP is disabled
Marc-André Lureau <[email protected]>
| Newsgroups | org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
When QEMU is built without HMP support, reject '-monitor' (which requests readline/HMP mode) early in monitor_new_opts() with a clear error message directing users to '-qmp' instead. Signed-off-by: Marc-Andre Lureau <[email protected]> --- monitor/monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monitor/monitor.c b/monitor/monitor.c index 6d6ffbb0f78a..8528af6f79b8 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -776,6 +776,16 @@ int monitor_new_opts(QemuOpts *opts, Error **errp) MonitorOptions *options; int ret; +#ifndef CONFIG_HMP + const char *mode = qemu_opt_get(opts, "mode"); + /* readline is HMP.. */ + if (mode && g_str_equal(mode, "readline")) { + error_setg(errp, "HMP monitor is not available," + " use '-qmp' instead of '-monitor'"); + return -1; + } +#endif + v = opts_visitor_new(opts); visit_type_MonitorOptions(v, NULL, &options, errp); visit_free(v); -- 2.55.0.543.g5ebe2ebe4ea8