From: Adam Litke <agl@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] QMP: Save default control monitor for emitting async events
Date: Thu, 14 Jan 2010 15:20:10 -0600 [thread overview]
Message-ID: <1263504010.2847.27.camel@aglitke> (raw)
When using a control/QMP monitor in tandem with a regular monitor, asynchronous
messages can get lost depending on the order of the QEMU program arguments.
QEMU events issued by monitor_protocol_event() always go to cur_mon. If the
user monitor was specified on the command line first (or it has ,default), the
message will be directed to the user monitor (not the QMP monitor).
One solution is to save the default QMP session in another monitor pointer (ala
cur_mon) and always direct asynchronous events to that monitor...
Signed-off-by: Adam Litke <agl@us.ibm.com>
diff --git a/monitor.c b/monitor.c
index 134ed15..794f6ba 100644
--- a/monitor.c
+++ b/monitor.c
@@ -128,6 +128,7 @@ static const mon_cmd_t mon_cmds[];
static const mon_cmd_t info_cmds[];
Monitor *cur_mon = NULL;
+Monitor *cur_mon_control = NULL;
static void monitor_command_cb(Monitor *mon, const char *cmdline,
void *opaque);
@@ -334,11 +335,11 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
{
QDict *qmp;
const char *event_name;
- Monitor *mon = cur_mon;
+ Monitor *mon = cur_mon_control;
assert(event < QEVENT_MAX);
- if (!monitor_ctrl_mode(mon))
+ if (!mon)
return;
switch (event) {
@@ -4283,6 +4284,9 @@ void monitor_init(CharDriverState *chr, int flags)
QLIST_INSERT_HEAD(&mon_list, mon, entry);
if (!cur_mon || (flags & MONITOR_IS_DEFAULT))
cur_mon = mon;
+ if (!cur_mon_control || (flags & MONITOR_IS_DEFAULT))
+ if (flags & MONITOR_USE_CONTROL)
+ cur_mon_control = mon;
}
static void bdrv_password_cb(Monitor *mon, const char *password, void *opaque)
diff --git a/monitor.h b/monitor.h
index 556239a..a343589 100644
--- a/monitor.h
+++ b/monitor.h
@@ -7,6 +7,7 @@
#include "block.h"
extern Monitor *cur_mon;
+extern Monitor *cur_mon_control;
/* flags for monitor_init */
#define MONITOR_IS_DEFAULT 0x01
diff --git a/qemu-tool.c b/qemu-tool.c
index 18b48af..cfe03d6 100644
--- a/qemu-tool.c
+++ b/qemu-tool.c
@@ -34,6 +34,7 @@ void qemu_service_io(void)
}
Monitor *cur_mon;
+Monitor *cur_mon_control;
void monitor_printf(Monitor *mon, const char *fmt, ...)
{
--
Thanks,
Adam
next reply other threads:[~2010-01-14 21:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 21:20 Adam Litke [this message]
2010-01-15 13:38 ` [Qemu-devel] Re: [PATCH] QMP: Save default control monitor for emitting async events Luiz Capitulino
2010-01-15 13:48 ` Adam Litke
2010-01-15 14:34 ` [Qemu-devel] [PATCH] QMP: Emit asynchronous events on all QMP monitors Adam Litke
2010-01-15 15:00 ` [Qemu-devel] " Luiz Capitulino
2010-01-15 15:16 ` [Qemu-devel] Re: [PATCH][RESPIN] " Adam Litke
2010-01-15 15:23 ` Luiz Capitulino
2010-01-19 22:40 ` [Qemu-devel] [PATCH] " Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263504010.2847.27.camel@aglitke \
--to=agl@us.ibm.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).