aboutsummaryrefslogtreecommitdiff
path: root/monitor/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor/misc.c')
-rw-r--r--monitor/misc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index 4ea575eea8..ee8db45094 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -125,13 +125,12 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
monitor_data_init(&hmp.common, false, true, false);
- old_mon = cur_mon;
- cur_mon = &hmp.common;
+ old_mon = monitor_set_cur(&hmp.common);
if (has_cpu_index) {
int ret = monitor_set_cpu(&hmp.common, cpu_index);
if (ret < 0) {
- cur_mon = old_mon;
+ monitor_set_cur(old_mon);
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
"a CPU number");
goto out;
@@ -139,7 +138,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
}
handle_hmp_command(&hmp, command_line);
- cur_mon = old_mon;
+ monitor_set_cur(old_mon);
WITH_QEMU_LOCK_GUARD(&hmp.common.mon_lock) {
if (qstring_get_length(hmp.common.outbuf) > 0) {
@@ -297,7 +296,7 @@ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize)
CPUState *mon_get_cpu(void)
{
- return mon_get_cpu_sync(cur_mon, true);
+ return mon_get_cpu_sync(monitor_cur(), true);
}
CPUArchState *mon_get_cpu_env(void)
@@ -1232,6 +1231,7 @@ static void hmp_acl_remove(Monitor *mon, const QDict *qdict)
void qmp_getfd(const char *fdname, Error **errp)
{
+ Monitor *cur_mon = monitor_cur();
mon_fd_t *monfd;
int fd, tmp_fd;
@@ -1270,6 +1270,7 @@ void qmp_getfd(const char *fdname, Error **errp)
void qmp_closefd(const char *fdname, Error **errp)
{
+ Monitor *cur_mon = monitor_cur();
mon_fd_t *monfd;
int tmp_fd;
@@ -1356,7 +1357,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
const char *opaque, Error **errp)
{
int fd;
- Monitor *mon = cur_mon;
+ Monitor *mon = monitor_cur();
AddfdInfo *fdinfo;
fd = qemu_chr_fe_get_msgfd(&mon->chr);