Hi On Mon, Aug 24, 2026 at 6:11 PM Daniel P. Berrangé <[email protected]> wrote: > > On Sun, Aug 16, 2026 at 11:13:01PM +0400, Marc-André Lureau wrote: > > Note that this fixes qemu_vprintf() (and thus qemu_printf) to do as said > > in the code comment: print to current HMP if we have one, else to > > stdout, instead of trying to print to the current monitor (which may not > > actually have hmp-only print capability/callback and fail silently). > > The question is whether that commented behaviour is actually > what we want ? AFAICT, the comment has been wrong since day > one - it always printed to HMP, and /dev/nulled for QMP, > and stdout thus only in non-monitor context. > > I'm not convinced that qemu_printf family should do anything > in QMP context - /dev/null feels like the right behaviour. > > We have warn_report/error_report which go to stderr in QMP > context which is right. I don't see a use case for > qemu_printf to stderr in QMP context.
I dropped this patch and instead made a documentation update in v4. thanks > > > > > Signed-off-by: Marc-André Lureau <[email protected]> > > --- > > util/qemu-print.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/util/qemu-print.c b/util/qemu-print.c > > index a2d1f0244168..0eecc05b0330 100644 > > --- a/util/qemu-print.c > > +++ b/util/qemu-print.c > > @@ -21,9 +21,9 @@ > > */ > > int qemu_vprintf(const char *fmt, va_list ap) > > { > > - Monitor *cur_mon = monitor_cur(); > > - if (cur_mon) { > > - return monitor_vprintf(cur_mon, fmt, ap); > > + MonitorHMP *hmp = monitor_cur_hmp(); > > + if (hmp) { > > + return monitor_vprintf(MONITOR(hmp), fmt, ap); > > } > > return vprintf(fmt, ap); > > } > > @@ -53,7 +53,8 @@ int qemu_printf(const char *fmt, ...) > > int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) > > { > > if (!stream) { > > - return monitor_vprintf(monitor_cur(), fmt, ap); > > + MonitorHMP *hmp = monitor_cur_hmp(); > > + return hmp ? monitor_vprintf(MONITOR(hmp), fmt, ap) : -1; > > } > > return vfprintf(stream, fmt, ap); > > } > > > > -- > > 2.55.0.543.g5ebe2ebe4ea8 > > > > With regards, > Daniel > -- > |: https://berrange.com ~~ https://hachyderm.io/@berrange :| > |: https://libvirt.org ~~ https://entangle-photo.org :| > |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :| >
