Received: from eggs.gnu.org ([2001:4830:134:3::10]:60464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC8GY-000070-0B for qemu-devel@nongnu.org; Wed, 21 Aug 2013 09:16:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VC8GK-0004DT-Ai for qemu-devel@nongnu.org; Wed, 21 Aug 2013 09:16:01 -0400 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:49618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VC8GK-0004DP-4Q for qemu-devel@nongnu.org; Wed, 21 Aug 2013 09:15:48 -0400 Received: by mail-we0-f173.google.com with SMTP id x54so403152wes.18 for ; Wed, 21 Aug 2013 06:15:47 -0700 (PDT) Date: Wed, 21 Aug 2013 15:15:44 +0200 From: Stefan Hajnoczi Message-ID: <20130821131544.GC11975@stefanha-thinkpad.redhat.com> References: <1377088001-8783-1-git-send-email-stefanha@redhat.com> <1377088001-8783-2-git-send-email-stefanha@redhat.com> <87li3v8abh.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87li3v8abh.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH 1/2] stubs: add error_report() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , Deepak C Shetty , qemu-devel@nongnu.org, Stefan Hajnoczi On Wed, Aug 21, 2013 at 03:04:02PM +0200, Markus Armbruster wrote: > Stefan Hajnoczi 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 > > --- > > 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 > > +#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? Good idea. I'll resend with util/qemu-error.o linked in. Stefan