From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=60904 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnTEH-0007Fm-IW for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:54:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnTE6-0004ow-1z for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:54:15 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:59340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnTE5-0004on-P7 for qemu-devel@nongnu.org; Thu, 10 Feb 2011 04:54:14 -0500 Received: by eyg7 with SMTP id 7so612491eyg.4 for ; Thu, 10 Feb 2011 01:54:13 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4D53B5BE.5000105@redhat.com> Date: Thu, 10 Feb 2011 10:54:06 +0100 From: Paolo Bonzini MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/7] Enable I/O thread and VNC threads by default References: <4D3DFD20.8060004@linux.vnet.ibm.com> <20110125091741.GB30239@edde.se.axis.com> <20110125133453.GC5427@amt.cnet> <20110207101255.GA20413@amt.cnet> <20110207160350.GA26332@amt.cnet> <4D501C71.7090708@redhat.com> <4D50279B.5010102@siemens.com> <4D505DCB.9050406@codemonkey.ws> <20110207214551.GB16429@hall.aurel32.net> <4D50A5F0.802@codemonkey.ws> <20110208072657.GD16429@hall.aurel32.net> <4D50FA14.5010100@redhat.com> <4D5103E8.6050808@siemens.com> <4D510771.3040309@aurel32.net> <4D511221.9030505@siemens.com> <4D5113D3.9090802@aurel32.net> <4D511500.1040303@siemens.com> <4D5115C2.6060008@aurel32.net> <4D51842C.8000209@codemonkey.ws> <4D5125E2.8090902@aurel32.net> <4D5196DE.6030009@codemonkey.ws> <4D514558.9010003@aurel32.net> <4D51AD7D.6060709@codemonkey.ws> <4D515CAB.6040700@aurel32.net> <4D531235.9040004@mail.berlios.de> In-Reply-To: <4D531235.9040004@mail.berlios.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Stefan Hajnoczi , Jan Kiszka , Marcelo Tosatti , "qemu-devel@nongnu.org" , Blue Swirl , Anthony Liguori , Paul Brook , Arun Bharadwaj , "Edgar E. Iglesias" , Aurelien Jarno On 02/09/2011 11:16 PM, Stefan Weil wrote: > The patch is available here: > http://repo.or.cz/w/qemu/ar7.git/commitdiff/aabf11dc0a938b84d76d7c147cbf0445d7bee297 > diff --git a/hosts/w32/include/signal.h b/hosts/w32/include/signal.h > new file mode 100644 > index 0000000..e45f03c > --- /dev/null > +++ b/hosts/w32/include/signal.h > @@ -0,0 +1,20 @@ > +/* > + * QEMU w32 support > + * > + * Copyright (C) 2011 Stefan Weil > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + */ > + > +#ifndef WIN32_SIGNAL_H > +#define WIN32_SIGNAL_H > + > +#include_next > +#include /* sigset_t */ > + > +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset); > +int sigfillset(sigset_t *set); > + > +#endif /* WIN32_SIGNAL_H */ > diff --git a/hosts/w32/include/time.h b/hosts/w32/include/time.h > new file mode 100644 > index 0000000..0b997d3 > --- /dev/null > +++ b/hosts/w32/include/time.h > @@ -0,0 +1,31 @@ > +/* > + * QEMU w32 support > + * > + * Copyright (C) 2011 Stefan Weil > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + * > + */ > + > +#if !defined(W32_TIME_H) > +#define W32_TIME_H > + > +#include_next > + > +#ifndef HAVE_STRUCT_TIMESPEC > +#define HAVE_STRUCT_TIMESPEC 1 > +struct timespec { > + long tv_sec; > + long tv_nsec; > +}; > +#endif /* HAVE_STRUCT_TIMESPEC */ > + > +typedef enum { > + CLOCK_REALTIME = 0 > +} clockid_t; > + > +int clock_getres (clockid_t clock_id, struct timespec *res); > +int clock_gettime(clockid_t clock_id, struct timespec *pTimespec); > + > +#endif /* W32_TIME_H */ > diff --git a/os-win32.c b/os-win32.c > index b214e6a..7778366 100644 > --- a/os-win32.c > +++ b/os-win32.c > @@ -36,6 +36,45 @@ > /***********************************************************/ > /* Functions missing in mingw */ > > +#if defined(CONFIG_THREAD) > + > +int clock_gettime(clockid_t clock_id, struct timespec *pTimespec) > +{ > + int result = 0; > + if (clock_id == CLOCK_REALTIME && pTimespec != 0) { > + DWORD t = GetTickCount(); > + const unsigned cps = 1000; > + struct timespec ts; > + ts.tv_sec = t / cps; > + ts.tv_nsec = (t % cps) * (1000000000UL / cps); > + *pTimespec = ts; > + } else { > + errno = EINVAL; > + result = -1; > + } > + return result; > +} Why is this needed? The only user of clock_gettime in the POSIX case is using CLOCK_MONOTONIC, and actually has a Win32 version already. > +int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset) > +{ > + /* Dummy, do nothing. */ > + return EINVAL; > +} > + > +int sigfillset(sigset_t *set) > +{ > + int result = 0; > + if (set) { > + *(set) = (sigset_t)(-1); > + } else { > + errno = EINVAL; > + result = -1; > + } > + return result; > +} Instead of these, it's better to provide a Win32 implementation of mutexes and condvars. I'll submit it next week hopefully. Paolo