|
@@ -395,10 +395,16 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)
|
|
|
monitor_list_append(&mon->common);
|
|
|
}
|
|
|
|
|
|
-void monitor_init_qmp(Chardev *chr, bool pretty)
|
|
|
+void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
|
|
|
{
|
|
|
MonitorQMP *mon = g_new0(MonitorQMP, 1);
|
|
|
|
|
|
+ if (!qemu_chr_fe_init(&mon->common.chr, chr, errp)) {
|
|
|
+ g_free(mon);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ qemu_chr_fe_set_echo(&mon->common.chr, true);
|
|
|
+
|
|
|
/* Note: we run QMP monitor in I/O thread when @chr supports that */
|
|
|
monitor_data_init(&mon->common, true, false,
|
|
|
qemu_chr_has_feature(chr, QEMU_CHAR_FEATURE_GCONTEXT));
|
|
@@ -408,9 +414,6 @@ void monitor_init_qmp(Chardev *chr, bool pretty)
|
|
|
qemu_mutex_init(&mon->qmp_queue_lock);
|
|
|
mon->qmp_requests = g_queue_new();
|
|
|
|
|
|
- qemu_chr_fe_init(&mon->common.chr, chr, &error_abort);
|
|
|
- qemu_chr_fe_set_echo(&mon->common.chr, true);
|
|
|
-
|
|
|
json_message_parser_init(&mon->parser, handle_qmp_command, mon, NULL);
|
|
|
if (mon->common.use_io_thread) {
|
|
|
/*
|