From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBU3Y-0005PN-KB for qemu-devel@nongnu.org; Tue, 11 Sep 2012 13:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBU3P-0003g9-GK for qemu-devel@nongnu.org; Tue, 11 Sep 2012 13:15:24 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:60590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBU3P-0003bd-8p for qemu-devel@nongnu.org; Tue, 11 Sep 2012 13:15:15 -0400 Message-ID: <504F719F.10707@weilnetz.de> Date: Tue, 11 Sep 2012 19:15:11 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1347348509-23900-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1347348509-23900-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] win32: provide gmtime_r emulation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Am 11.09.2012 09:28, schrieb Paolo Bonzini: > Windows has _s functions from C99 instead of _r functions from POSIX. > Add an emulation shim. > > Signed-off-by: Paolo Bonzini > --- > Not tested beyond compilation. Hi Paolo, latest MinGW-w64 supports _gmtime32_s, but MinGW does not, so this solution won't link with MinGW. With MinGW-w64, I get a compiler warning because _gmtime32_s is not declared. The declaration is only enabled when macro MINGW_HAS_SECURE_API is defined. mingw-w64-crt/secapi/_gmtime32_s.cimplements _gmtime32_s by first looking for that symbol in msvcrt.dll. Only some newer versions of that Microsoft C Runtime library include _gmtime32_s. Therefore the implementation includes a fallback which uses the simple gmtime. We should either use a wrapper based on gmtime (like the MinGW-w64 fallback implementation). Then a wrapper for localtime_r would also be reasonable. I don't expect critical re-entrancy problems caused by that pragmatic solution. Or we use conditional compilation (#ifdef _WIN32) like it is currently done for localtime_r in a small number of QEMU source files. Regards, Stefan