monitor_printf(mon, "'");
}
-/*
- * Print to the current human monitor if we have one, else to stderr.
- */
-int error_vprintf(const char *fmt, va_list ap)
-{
- Monitor *cur_mon = monitor_cur();
- /*
- * This will return -1 if 'cur_mon' is NULL, or is QMP.
- * IOW this will only print if in HMP, otherwise we
- * fallback to stderr for QMP / no-monitor scenarios.
- */
- int ret = monitor_vprintf(cur_mon, fmt, ap);
- if (ret == -1) {
- ret = vfprintf(stderr, fmt, ap);
- }
- return ret;
-}
-
static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] = {
/* Limit guest-triggerable events to 1 per second */
[QAPI_EVENT_RTC_CHANGE] = { 1000 * SCALE_MS },
+++ /dev/null
-#include "qemu/osdep.h"
-#include "qemu/error-report.h"
-#include "monitor/monitor.h"
-
-int error_vprintf(const char *fmt, va_list ap)
-{
- int ret;
-
- if (g_test_initialized() && !g_test_subprocess() &&
- getenv("QTEST_SILENT_ERRORS")) {
- char *msg = g_strdup_vprintf(fmt, ap);
- g_test_message("%s", msg);
- ret = strlen(msg);
- g_free(msg);
- return ret;
- }
- return vfprintf(stderr, fmt, ap);
-}
# below, so that it is clear who needs the stubbed functionality.
stub_ss.add(files('cpu-get-clock.c'))
-stub_ss.add(files('error-printf.c'))
stub_ss.add(files('fdset.c'))
stub_ss.add(files('iothread-lock.c'))
stub_ss.add(files('is-daemonized.c'))
int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
{
- abort();
+ /*
+ * 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;
}
bool error_with_guestname;
const char *error_guest_name;
+/*
+ * Print to the current human monitor if we have one, else to stderr.
+ */
+int error_vprintf(const char *fmt, va_list ap)
+{
+ Monitor *cur_mon = monitor_cur();
+ /*
+ * This will return -1 if 'cur_mon' is NULL, or is QMP.
+ * IOW this will only print if in HMP, otherwise we
+ * fallback to stderr for QMP / no-monitor scenarios.
+ */
+ int ret = monitor_vprintf(cur_mon, fmt, ap);
+ if (ret == -1) {
+ ret = vfprintf(stderr, fmt, ap);
+ }
+ return ret;
+}
+
int error_printf(const char *fmt, ...)
{
va_list ap;