From: "consul" <consul@collegeclub.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: supplement timegm function for Solaris in cutils.c
Date: Fri, 9 Nov 2007 16:47:17 -0800 [thread overview]
Message-ID: <fh2v2n$8b0$1@ger.gmane.org> (raw)
In-Reply-To: 20071109142635.5NICO.161491.root@eastrmwml12
Windows does not seem to have this function either.
With your patch I was able to compile most of the targets from the current
CVS tree (except arm), but at least i386-softmmu is broken.
It crashes immediately with the following error:
Starting program: c:\qemu-dist9/qemu.exe -L . -hda c:\qemu-img\wxp.q2 -boot
c -localtime -m 512 -net nic,model=rtl8139 -net
tap,ifname=TAP0 -kernel-kqemu
Program received signal SIGSEGV, Segmentation fault.
qcow_aio_read_cb (opaque=0x23dfcc70, ret=-22) at block-qcow2.c:840
840 acb->common.cb(acb->common.opaque, 0);
(gdb) q
Alex.
"Ben Taylor" <sol10x86@cox.net> wrote in message
news:20071109142635.5NICO.161491.root@eastrmwml12...
>
> Solaris doesn't have the timegm function, so I found a replacement and
> wedge it into cutils.c.
>
> I found the supplement for timegm in the opensync repository at:
> http://www.opensync.org/changeset/1769
>
> --- qemu.ORIG/cutils.c 2007-09-16 17:07:49.000000000 -0400
> +++ qemu/cutils.c 2007-11-09 14:11:04.005353000 -0500
> @@ -81,3 +81,38 @@
> *ptr = p;
> return 1;
> }
> +
> +#ifdef __sun__
> +/*
> + * On solaris no timegm function exists,
> + * we must implement it here
> + */
> +time_t timegm(struct tm *t)
> +{
> + time_t tl, tb;
> + struct tm *tg;
> +
> + tl = mktime (t);
> + if (tl == -1)
> + {
> + t->tm_hour--;
> + tl = mktime (t);
> + if (tl == -1)
> + return -1; /* can't deal with output from strptime */
> + tl += 3600;
> + }
> + tg = gmtime (&tl);
> + tg->tm_isdst = 0;
> + tb = mktime (tg);
> + if (tb == -1)
> + {
> + tg->tm_hour--;
> + tb = mktime (tg);
> + if (tb == -1)
> + return -1; /* can't deal with output from gmtime */
> + tb += 3600;
> + }
> + return (tl - (tb - tl));
> +}
> +#endif
> +
>
>
>
>
prev parent reply other threads:[~2007-11-10 0:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-09 19:26 [Qemu-devel] supplement timegm function for Solaris in cutils.c Ben Taylor
2007-11-10 0:47 ` consul [this message]
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='fh2v2n$8b0$1@ger.gmane.org' \
--to=consul@collegeclub.com \
--cc=qemu-devel@nongnu.org \
/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).