From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IqeVc-0002Xf-Mv for qemu-devel@nongnu.org; Fri, 09 Nov 2007 19:47:36 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IqeVb-0002XS-0u for qemu-devel@nongnu.org; Fri, 09 Nov 2007 19:47:35 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IqeVa-0002XP-Ri for qemu-devel@nongnu.org; Fri, 09 Nov 2007 19:47:34 -0500 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IqeVZ-0005gc-Or for qemu-devel@nongnu.org; Fri, 09 Nov 2007 19:47:34 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IqeVR-00065b-G4 for qemu-devel@nongnu.org; Sat, 10 Nov 2007 00:47:25 +0000 Received: from 204.147.152.1 ([204.147.152.1]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Nov 2007 00:47:25 +0000 Received: from consul by 204.147.152.1 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Nov 2007 00:47:25 +0000 From: "consul" Date: Fri, 9 Nov 2007 16:47:17 -0800 Message-ID: References: <20071109142635.5NICO.161491.root@eastrmwml12> Sender: news Subject: [Qemu-devel] Re: supplement timegm function for Solaris in cutils.c Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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" 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 > + > > > >