Received: from eggs.gnu.org ([140.186.70.92]:37329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUeT9-0004Sf-Ok for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:36:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUeT7-0003QG-SU for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:36:15 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:39679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUeT7-0003Mq-8a for qemu-devel@nongnu.org; Thu, 09 Jun 2011 08:36:13 -0400 Message-Id: From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <1307573737-33421-1-git-send-email-agraf@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v936) Date: Thu, 9 Jun 2011 14:36:10 +0200 References: <1307573737-33421-1-git-send-email-agraf@suse.de> Sender: andreas.faerber@web.de Subject: Re: [Qemu-devel] [PATCH] sigfd: use pthread_sigmask List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Paolo Bonzini , qemu-devel Developers , Jan Kiszka Am 09.06.2011 um 00:55 schrieb Alexander Graf: > Qemu uses signalfd to figure out, if a signal occured without the need > to actually receive the signal. Instead, it can read from the fd to =20= > receive > its news. > > Now, we obviously don't always have signalfd around. Especially not on > non-Linux systems. So what we do there is that we create a new thread, > block that thread on all signals and simply call sigwait to wait for a > signal we're interested in to occur. > > This all sounds great, but what we're really doing is: > > sigset_t all; > > sigfillset(&all); > sigprocmask(SIG_BLOCK, &all, NULL); > > which - on Darwin - blocks all signals on the current _process_, not =20= > only > on the current thread. To block signals on the thread, we can use > pthread_sigmask(). > > This patch does that, assuming that my above analysis is correct, =20 > and thus > renders Qemu useable on Darwin again. > > Reported-by: Andreas F=E4rber > CC: Paolo Bonzini > CC: Jan Kiszka > CC: Anthony Liguori > Signed-off-by: Alexander Graf According to POSIX:2008, the use of sigprocmask() is only well-defined =20= for a single-threaded process. This patch fixed the default configuration (without --enable-io-=20 thread) for me. Thanks, Andreas > --- > compatfd.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/compatfd.c b/compatfd.c > index bd377c4..41586ce 100644 > --- a/compatfd.c > +++ b/compatfd.c > @@ -29,7 +29,7 @@ static void *sigwait_compat(void *opaque) > sigset_t all; > > sigfillset(&all); > - sigprocmask(SIG_BLOCK, &all, NULL); > + pthread_sigmask(SIG_BLOCK, &all, NULL); > > while (1) { > int sig; > --=20 > 1.7.1