From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXVxu-0003uu-VD for qemu-devel@nongnu.org; Wed, 01 May 2013 08:16:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXVxt-0005Fo-CO for qemu-devel@nongnu.org; Wed, 01 May 2013 08:16:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXVxt-0005Fi-2m for qemu-devel@nongnu.org; Wed, 01 May 2013 08:16:53 -0400 Message-ID: <518107A1.7050906@redhat.com> Date: Wed, 01 May 2013 06:16:33 -0600 From: Eric Blake MIME-Version: 1.0 References: <1367265445-27365-1-git-send-email-saguchi@redhat.com> <20130501120550.GC28932@stefanha-thinkpad.redhat.com> In-Reply-To: <20130501120550.GC28932@stefanha-thinkpad.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2EXPQLPVABPAPSMNCRHOC" Subject: Re: [Qemu-devel] [RFC][PATCH v2]Add timestamp to error message List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, aliguori@us.ibm.com, tomoki.sekiyama@hds.com, mst@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com, dle-develop@lists.sourceforge.net, av1474@comtv.ru, stefanha@redhat.com, lcapitulino@redhat.com, pbonzini@redhat.com, Seiji Aguchi , Seiji Aguchi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2EXPQLPVABPAPSMNCRHOC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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); >=20 > 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.ht= ml --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2EXPQLPVABPAPSMNCRHOC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRgQehAAoJEKeha0olJ0NqGkIH/jkdxSYrCRE/YA4DAFjOqgSI qnGaqUXUUWoir8sItiETsHnDf8WC1Wsgk0muEzOGBDhTZ2Pjap+36/t1ptXDeL7x wP7r77b/Bz8yECiGysb2ZBH6Z1A37d3/3coHV7xWdbwEYS+VjnDlEujGGCK0u5P/ qgDsVXliDmUekXM0jTbE6/Tr76GyX2Hm9Z92Tbx2YMBq4N5vaeQ0q68qFehGyCP8 qpn3x9YrgOEIiBMFDgUE8UUp4kNeBmXpkLjfoE3wUF/JDN9TlJXYqApPOitPgJZ3 xEosysLGfuAd0ZoeAUD6dfBJ8WT3zCFVoiuc2fZ/n2+EGCS7WfsOe5FeRpcYImE= =uxcO -----END PGP SIGNATURE----- ------enig2EXPQLPVABPAPSMNCRHOC--