qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] win32: provide gmtime_r emulation


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] win32: provide gmtime_r emulation
Date: Tue, 11 Sep 2012 19:15:11 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0

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 <address@hidden>
---
         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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]