The vreport() function will print to HMP if available, otherwise
to stderr. In the event that vreport() is called during execution
of a QMP command, it will print to stderr, but mistakenly omit the
message prefixes (timestamp, guest name, program name).
This new usage of monitor_is_cur_qmp() from vreport() requires that
we add a stub to satisfy linking of non-system emulator binaries.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
return NULL;
}
+bool monitor_cur_is_qmp(void)
+{
+ return false;
+}
+
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
{
return NULL;
Monitor *monitor_cur(void) { return cur_mon; }
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); }
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); }
+bool monitor_cur_is_qmp(void) { abort(); };
#ifndef _WIN32
static void test_socket_fd_pass_name_good(void)
Monitor *cur = monitor_cur();
gchar *timestr;
+ /*
+ * When current monitor is QMP, messages must go to stderr
+ * and have prefixes added
+ */
+ if (monitor_cur_is_qmp()) {
+ cur = NULL;
+ }
+
if (message_with_timestamp && !cur) {
timestr = real_time_iso8601();
fprintf(stderr, "%s ", timestr);