qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: supplement timegm function for Solaris in cutils.c


From: consul
Subject: [Qemu-devel] Re: supplement timegm function for Solaris in cutils.c
Date: Fri, 9 Nov 2007 16:47:17 -0800

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" <address@hidden> wrote in message 
news:address@hidden
>
> 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
> +
>
>
>
> 







reply via email to

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