new file mode 100644
@@ -0,0 +1,21 @@
+/*
+ * QEvent Support
+ *
+ * Copyright IBM, Corp. 2013
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QMP_EVENTS_H
+#define QMP_EVENTS_H
+
+#include "qemu/notify.h"
+
+void qmp_add_event_notifier(Notifier *notifier);
+void qmp_del_event_notifier(Notifier *notifier);
+
+#endif
@@ -56,6 +56,7 @@
#include "qapi/qmp/qjson.h"
#include "qapi/qmp/json-streamer.h"
#include "qapi/qmp/json-parser.h"
+#include "qapi/qmp/qevents.h"
#include "qemu/osdep.h"
#include "cpu.h"
#include "trace.h"
@@ -502,6 +503,19 @@ QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX)
MonitorEventState monitor_event_state[QEVENT_MAX];
QemuMutex monitor_event_state_lock;
+static NotifierList qmp_event_notifier_list =
+ NOTIFIER_LIST_INITIALIZER(qmp_event_notifier_list);
+
+void qmp_add_event_notifier(Notifier *notifier)
+{
+ notifier_list_add(&qmp_event_notifier_list, notifier);
+}
+
+void qmp_del_event_notifier(Notifier *notifier)
+{
+ notifier_remove(notifier);
+}
+
/*
* Emits the event to every monitor instance
*/
@@ -512,6 +526,7 @@ monitor_protocol_event_emit(MonitorEvent event,
Monitor *mon;
trace_monitor_protocol_event_emit(event, data);
+ notifier_list_notify(&qmp_event_notifier_list, data);
QLIST_FOREACH(mon, &mon_list, entry) {
if (monitor_ctrl_mode(mon) && qmp_cmd_mode(mon)) {
monitor_json_emitter(mon, data);
This lets us register for events internally within QEMU. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- include/qapi/qmp/qevents.h | 21 +++++++++++++++++++++ monitor.c | 15 +++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 include/qapi/qmp/qevents.h