Files
qemu/stubs/monitor-core.c
Daniel P. Berrangé 6365e97c84 util: don't skip error prefixes when QMP is active
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>
2026-03-05 17:40:24 +00:00

40 lines
789 B
C

#include "qemu/osdep.h"
#include "monitor/monitor.h"
#include "qapi/qapi-emit-events.h"
Monitor *monitor_cur(void)
{
return NULL;
}
bool monitor_cur_is_qmp(void)
{
return false;
}
Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
{
return NULL;
}
void qapi_event_emit(QAPIEvent event, QDict *qdict)
{
}
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
{
/*
* Pretend 'g_test_message' is our monitor console to
* stop the caller sending messages to stderr
*/
if (g_test_initialized() && !g_test_subprocess() &&
getenv("QTEST_SILENT_ERRORS")) {
char *msg = g_strdup_vprintf(fmt, ap);
g_test_message("%s", msg);
size_t ret = strlen(msg);
g_free(msg);
return ret;
}
return -1;
}