From: Paolo Bonzini <pbonzini@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: "dle-develop@lists.sourceforge.net"
<dle-develop@lists.sourceforge.net>,
Seiji Aguchi <seiji.aguchi@hds.com>,
Satoru Moriya <satoru.moriya@hds.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC][PATCH]Add timestamp to error message
Date: Thu, 04 Apr 2013 17:20:24 +0200 [thread overview]
Message-ID: <515D9A38.9030205@redhat.com> (raw)
In-Reply-To: <515D941B.5010605@redhat.com>
Il 04/04/2013 16:54, Laszlo Ersek ha scritto:
> Side note: strictly in theory, this would result in two vfprintf()
> calls. The message log would remain "record oriented", but (again, in
> theory) another thread *might* get interleaved and mess up our format
> with a parallel call to error_report() (or more deeply, to fprintf()).
>
> Importantly I'm not talking about "corrupting data"; stdio streams are
> automatically locked by the fprintf() family. The thing (theoretically,
> possibly) corrupted would be our record-oriented message format, by
> interleaved printfs.
>
> (a) I'm not sure if this is possible at all in qemu.
It would be one more thing that is protected by the big QEMU lock.
Regarding your other comment, please use gmtime_r, not gmtime.
Paolo
> (b) Anyway, there are two ways to fix it:
>
> (b1) In error_report(), lock the stream across the two printfs with
> flockfile(). Probably overkill, and in case we're printing to the
> monitor, wasteful/useless. Or,
> (b2) Format the full message (including the timestamp) into a buffer
> (sprintf, vsprintf(), or their glib wrappers with automatic allocation,
> if any) and print it with a single error_printf("%s", buf).
>
> Anyway I absolutely do not insist on this, so sorry for the noise.
prev parent reply other threads:[~2013-04-04 15:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-01 14:53 [Qemu-devel] [RFC][PATCH]Add timestamp to error message Seiji Aguchi
2013-02-01 18:28 ` Laszlo Ersek
2013-02-01 20:25 ` Seiji Aguchi
2013-02-01 21:35 ` Eric Blake
2013-02-01 22:41 ` Seiji Aguchi
2013-02-02 7:23 ` Markus Armbruster
2013-02-02 7:31 ` Markus Armbruster
2013-04-04 14:54 ` Laszlo Ersek
2013-04-04 15:20 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=515D9A38.9030205@redhat.com \
--to=pbonzini@redhat.com \
--cc=dle-develop@lists.sourceforge.net \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=satoru.moriya@hds.com \
--cc=seiji.aguchi@hds.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.