diff --git a/monitor.c b/monitor.c index 4b6184b7656115c473095659b05991b1e12a1fd5..d8a31242b640266ea510cc47d28092ae94b4e475 100644 --- a/monitor.c +++ b/monitor.c @@ -194,6 +194,12 @@ static inline int monitor_ctrl_mode(const Monitor *mon) return (mon->flags & MONITOR_USE_CONTROL); } +/* Return non-zero iff we have a current monitor, and it is in QMP mode. */ +int monitor_cur_is_qmp(void) +{ + return cur_mon && monitor_ctrl_mode(cur_mon); +} + static void monitor_read_command(Monitor *mon, int show_prompt) { if (!mon->rs) diff --git a/monitor.h b/monitor.h index dbb7becba91d6289f47135492fcfecf1bf064368..bd4ae34d48d354adf7ecee35283f79157f2ef67f 100644 --- a/monitor.h +++ b/monitor.h @@ -31,6 +31,8 @@ typedef enum MonitorEvent { QEVENT_MAX, } MonitorEvent; +int monitor_cur_is_qmp(void); + void monitor_protocol_event(MonitorEvent event, QObject *data); void monitor_init(CharDriverState *chr, int flags);