From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV9A7-0003EF-4N for qemu-devel@nongnu.org; Fri, 10 Jun 2011 17:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QV9A5-0006JC-AC for qemu-devel@nongnu.org; Fri, 10 Jun 2011 17:22:38 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:44418) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QV9A4-0006J8-Qg for qemu-devel@nongnu.org; Fri, 10 Jun 2011 17:22:37 -0400 Received: by fxm2 with SMTP id 2so2142647fxm.4 for ; Fri, 10 Jun 2011 14:22:35 -0700 (PDT) Date: Fri, 10 Jun 2011 23:22:32 +0200 From: "Edgar E. Iglesias" Message-ID: <20110610212232.GC29885@laped.lan> References: <1307573737-33421-1-git-send-email-agraf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1307573737-33421-1-git-send-email-agraf@suse.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 , Andreas =?iso-8859-1?Q?F=E4rber?= , qemu-devel Developers , Jan Kiszka On Thu, Jun 09, 2011 at 12:55:37AM +0200, Alexander Graf wrote: > 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 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 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 thus > renders Qemu useable on Darwin again. Applied, thanks all. Cheers > > Reported-by: Andreas Färber > 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; > > sigfillset(&all); > - sigprocmask(SIG_BLOCK, &all, NULL); > + pthread_sigmask(SIG_BLOCK, &all, NULL); > > while (1) { > int sig; > -- > 1.7.1