Received: from eggs.gnu.org ([140.186.70.92]:34947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUgwZ-0004jC-JU for qemu-devel@nongnu.org; Thu, 09 Jun 2011 11:14:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUgwY-0007x7-12 for qemu-devel@nongnu.org; Thu, 09 Jun 2011 11:14:47 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:47948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUgwX-0007wy-Fa for qemu-devel@nongnu.org; Thu, 09 Jun 2011 11:14:45 -0400 Message-Id: <23C4AF25-016A-40FF-99FA-A51013CCE96C@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: 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 17:14:41 +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: qemu-devel Developers Am 09.06.2011 um 14:36 schrieb Andreas F=E4rber: > Am 09.06.2011 um 00:55 schrieb Alexander Graf: > >> Qemu uses signalfd to figure out, if a signal occured without the =20 >> 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 =20= >> on >> non-Linux systems. So what we do there is that we create a new =20 >> thread, >> block that thread on all signals and simply call sigwait to wait =20 >> 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_, =20 >> not 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-=20 > defined for a single-threaded process. And of course I forgot: Acked-by: Andreas F=E4rber > 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 > >