qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] stubs: add error_report()


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] stubs: add error_report()
Date: Wed, 21 Aug 2013 15:04:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Stefan Hajnoczi <address@hidden> writes:

> The error report function is preferred over fprintf(stderr, ...) since
> it prints to the current monitor, if any.
>
> Add a stub error_report() implementation that just prints to stderr.
> This is suitable in environments where there is no QEMU monitor, such as
> libcacard.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  stubs/Makefile.objs  |  1 +
>  stubs/error-report.c | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 stubs/error-report.c
>
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index f306cba..f84d597 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -3,6 +3,7 @@ stub-obj-y += clock-warp.o
>  stub-obj-y += cpu-get-clock.o
>  stub-obj-y += cpu-get-icount.o
>  stub-obj-y += dump.o
> +stub-obj-y += error-report.o
>  stub-obj-y += fdset-add-fd.o
>  stub-obj-y += fdset-find-fd.o
>  stub-obj-y += fdset-get-fd.o
> diff --git a/stubs/error-report.c b/stubs/error-report.c
> new file mode 100644
> index 0000000..e39d0a9
> --- /dev/null
> +++ b/stubs/error-report.c
> @@ -0,0 +1,12 @@
> +#include <stdio.h>
> +#include "qemu/error-report.h"
> +
> +void error_report(const char *fmt, ...)
> +{
> +    va_list ap;
> +
> +    va_start(ap, fmt);
> +    vfprintf(stderr, fmt, ap);
> +    va_end(ap);
> +    fprintf(stderr, "\n");
> +}

We already have a monitor stubs (mon-set-error.c mon-printf.c ...) so we
can use error_report() in utility programs.  Why doesn't that suffice
here?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]