]> git.proxmox.com Git - qemu.git/commit
add qemu_error() + friends
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 14 Aug 2009 08:36:06 +0000 (10:36 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 28 Aug 2009 01:43:33 +0000 (20:43 -0500)
commitac7531ecdc8349ffc3a8d85721218df5585e30b6
tree61b23e3a7f491b9f5939f03ab77527e9183be0cb
parent81a322d4a1b68d47908a6630bf22897a289722aa
add qemu_error() + friends

This patch adds some functions for error reporting to address the
problem that error messages should be routed to different destinations
depending on the context of the caller, i.e. monitor command errors
should go to the monitor, command line errors to stderr.

qemu_error() is a printf-like function to report errors.

qemu_errors_to_file() and qemu_errors_to_mon() switch the destination
for the error message to the specified file or monitor.  When setting a
new destination the old one will be kept.  One can switch back using
qemu_errors_to_previous().  i.e. it works like a stack.

main() calls qemu_errors_to_file(stderr), so errors go to stderr by
default.  monitor callbacks are wrapped into qemu_errors_to_mon() +
qemu_errors_to_previous(), so any errors triggered by monitor commands
will go to the monitor.

Each thread has its own error message destination.  qemu-kvm probably
should add a qemu_errors_to_file(stderr) call to the i/o-thread
initialization code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
monitor.c
sysemu.h
vl.c