aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/monitor.c b/monitor.c
index 861803c..0749dc5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1006,7 +1006,7 @@ static void qmp_unregister_commands_hack(void)
#endif
}
-void monitor_init_qmp_commands(void)
+static void monitor_init_qmp_commands(void)
{
/*
* Two command lists:
@@ -3988,6 +3988,14 @@ static void sortcmdlist(void)
qsort((void *)info_cmds, array_num, elem_size, compare_mon_cmd);
}
+void monitor_init_globals(void)
+{
+ monitor_init_qmp_commands();
+ monitor_qapi_event_init();
+ sortcmdlist();
+ qemu_mutex_init(&monitor_lock);
+}
+
/* These functions just adapt the readline interface in a typesafe way. We
* could cast function pointers but that discards compiler checks.
*/
@@ -4028,23 +4036,10 @@ void error_vprintf_unless_qmp(const char *fmt, va_list ap)
}
}
-static void __attribute__((constructor)) monitor_lock_init(void)
-{
- qemu_mutex_init(&monitor_lock);
-}
-
void monitor_init(Chardev *chr, int flags)
{
- static int is_first_init = 1;
- Monitor *mon;
-
- if (is_first_init) {
- monitor_qapi_event_init();
- sortcmdlist();
- is_first_init = 0;
- }
+ Monitor *mon = g_malloc(sizeof(*mon));
- mon = g_malloc(sizeof(*mon));
monitor_data_init(mon, false);
qemu_chr_fe_init(&mon->chr, chr, &error_abort);