From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJ1qp-0007QN-Nv for qemu-devel@nongnu.org; Tue, 23 Jun 2009 04:59:35 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJ1ql-0007Pd-Tp for qemu-devel@nongnu.org; Tue, 23 Jun 2009 04:59:35 -0400 Received: from [199.232.76.173] (port=60541 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ1ql-0007Pa-Qp for qemu-devel@nongnu.org; Tue, 23 Jun 2009 04:59:31 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:21737) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MJ1ql-0006Pw-9O for qemu-devel@nongnu.org; Tue, 23 Jun 2009 04:59:31 -0400 Message-ID: <4A40996F.7070804@siemens.com> Date: Tue, 23 Jun 2009 10:59:27 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <20090623012911.16b8c4d5@doriath> In-Reply-To: <20090623012911.16b8c4d5@doriath> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 06/11] QMP: Introduce asynchronous events infrastructure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, ehabkost@redhat.com, dlaor@redhat.com, qemu-devel@nongnu.org, avi@redhat.com Luiz Capitulino wrote: > It is just an exported function that will be used by other subsystems > to print specific events to the output buffer. > > This is based in ideas by Amit Shah . > > Signed-off-by: Luiz Capitulino > --- > monitor.c | 18 ++++++++++++++++++ > monitor.h | 6 ++++++ > qemu-tool.c | 4 ++++ > 3 files changed, 28 insertions(+), 0 deletions(-) > > diff --git a/monitor.c b/monitor.c > index 462f60b..df58bdd 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -266,6 +266,24 @@ void monitor_printf_data(Monitor *mon, const char *fmt, ...) > va_end(ap); > } > > +/* Asynchronous events main function */ > +void monitor_notify_event(MonitorEvent event) > +{ > + if (!monitor_ctrl_mode(cur_mon)) > + return; > + > + assert(event < EVENT_MAX); > + monitor_puts(cur_mon, "* EVENT "); > + > + switch (event) { > + case EVENT_MAX: > + // Avoid gcc warning, will never get here > + break; > + } > + > + monitor_puts(cur_mon, "\n"); > +} > + You shouldn't use cur_mon here. It's for legacy code that still assumes there can be only one monitor terminal. Instead, iterate over all monitors and distribute the event to those that are in control mode. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux