From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: sw@weilnetz.de
Subject: [Qemu-devel] [PATCH] win32: provide gmtime_r emulation
Date: Tue, 11 Sep 2012 09:28:29 +0200 [thread overview]
Message-ID: <1347348509-23900-1-git-send-email-pbonzini@redhat.com> (raw)
Windows has _s functions from C99 instead of _r functions from POSIX.
Add an emulation shim.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Not tested beyond compilation.
os-win32.c | 12 ++++++++++++
qemu-os-win32.h | 1 +
2 file modificati, 13 inserzioni(+)
diff --git a/os-win32.c b/os-win32.c
index 13892ba..beeded2 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -55,6 +55,18 @@ int setenv(const char *name, const char *value, int overwrite)
return result;
}
+struct tm *gmtime_r(const time_t *timep, struct tm *result)
+{
+ int rc;
+ rc = _gmtime32_s(result, timep);
+ if (rc == 0) {
+ return result;
+ } else {
+ errno = rc;
+ return NULL;
+ }
+}
+
static BOOL WINAPI qemu_ctrl_handler(DWORD type)
{
qemu_system_shutdown_request();
diff --git a/qemu-os-win32.h b/qemu-os-win32.h
index 753679b..284cabb 100644
--- a/qemu-os-win32.h
+++ b/qemu-os-win32.h
@@ -79,6 +79,7 @@ static inline void os_set_proc_name(const char *dummy) {}
#endif
int setenv(const char *name, const char *value, int overwrite);
+struct tm *gmtime_r(const time_t *timep, struct tm *result);
typedef struct {
long tv_sec;
--
1.7.11.2
next reply other threads:[~2012-09-11 7:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-11 7:28 Paolo Bonzini [this message]
2012-09-11 17:15 ` [Qemu-devel] [PATCH] win32: provide gmtime_r emulation Stefan Weil
2012-09-11 17:57 ` Paolo Bonzini
2012-09-12 4:17 ` Stefan Weil
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=1347348509-23900-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).