All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com,
	Seiji Aguchi <seiji.aguchi@hds.com>,
	stefanha@redhat.com, mst@redhat.com,
	Stefan Hajnoczi <stefanha@gmail.com>,
	mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com,
	dle-develop@lists.sourceforge.net, av1474@comtv.ru,
	tomoki.sekiyama@hds.com, pbonzini@redhat.com,
	lcapitulino@redhat.com, Seiji Aguchi <saguchi@redhat.com>
Subject: Re: [Qemu-devel] [RFC][PATCH v2]Add timestamp to error message
Date: Wed, 1 May 2013 13:25:00 +0100	[thread overview]
Message-ID: <20130501122500.GG13875@redhat.com> (raw)
In-Reply-To: <518107A1.7050906@redhat.com>

On Wed, May 01, 2013 at 06:16:33AM -0600, Eric Blake wrote:
> On 05/01/2013 06:05 AM, Stefan Hajnoczi wrote:
> 
> >> +    error_printf(
> >> +           "%4d-%02d-%02d %02d:%02d:%02d.%03lld+0000 ",
> >> +           fields.tm_year + 1900, fields.tm_mon + 1, fields.tm_mday,
> >> +           fields.tm_hour, fields.tm_min, fields.tm_sec,
> >> +           now % 1000);
> > 
> > Can strftime(3) be used instead of copying code from glibc?
> 
> No, because glibc's strftime() is not async-signal safe, and therefore
> is not safe to call between fork() and exec() (libvirt hit actual
> deadlocks[1] where a child was blocked on a mutex associated with
> time-related functions that happened to be held by another parent
> thread, but where the fork nuked that other thread so the mutex would
> never clear).  This code is copied from libvirt, which copied the
> no-lock-needed safe portions of glibc for a reason.
> 
> [1] https://www.redhat.com/archives/libvir-list/2011-November/msg01609.html

NB the original libvirt code had this & other related functions in
a standalone file, along with a significant test suite. I think it
is better from a maintenence POV to keep this functionality in a
file that's separate from the qemu error file, so it can be reused
elsewhere in QEMU if needed. It should also copy the test suite,
since it is bad practice to throw away tests which already exist.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2013-05-01 12:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-29 19:57 [Qemu-devel] [RFC][PATCH v2]Add timestamp to error message Seiji Aguchi
2013-05-01 12:05 ` Stefan Hajnoczi
2013-05-01 12:16   ` Eric Blake
2013-05-01 12:25     ` Daniel P. Berrange [this message]
2013-05-01 14:26       ` Anthony Liguori
2013-05-02 20:39         ` Seiji Aguchi

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=20130501122500.GG13875@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=av1474@comtv.ru \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=saguchi@redhat.com \
    --cc=seiji.aguchi@hds.com \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=tomoki.sekiyama@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.