From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QURg7-0006E2-U0 for qemu-devel@nongnu.org; Wed, 08 Jun 2011 18:56:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QURg6-0002u0-1B for qemu-devel@nongnu.org; Wed, 08 Jun 2011 18:56:47 -0400 Received: from cantor.suse.de ([195.135.220.2]:52518 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QURg5-0002tj-Ne for qemu-devel@nongnu.org; Wed, 08 Jun 2011 18:56:45 -0400 From: Alexander Graf Date: Thu, 9 Jun 2011 00:55:37 +0200 Message-Id: <1307573737-33421-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] sigfd: use pthread_sigmask List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Developers Cc: Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Jan Kiszka 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 recei= ve 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 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, and thu= s renders Qemu useable on Darwin again. Reported-by: Andreas F=C3=A4rber CC: Paolo Bonzini CC: Jan Kiszka CC: Anthony Liguori Signed-off-by: Alexander Graf --- 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; =20 sigfillset(&all); - sigprocmask(SIG_BLOCK, &all, NULL); + pthread_sigmask(SIG_BLOCK, &all, NULL); =20 while (1) { int sig; --=20 1.7.1