]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
sigfd: use pthread_sigmask
authorAlexander Graf <agraf@suse.de>
Wed, 8 Jun 2011 22:55:37 +0000 (00:55 +0200)
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>
Fri, 10 Jun 2011 21:18:19 +0000 (23:18 +0200)
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.

Reported-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Paolo Bonizni <pbonzini@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
CC: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
compatfd.c

index bd377c411a365f9cc8141e42678fd84f424bdadd..41586ceaea969e1eef23c17ec8214a3aa5a3f8ff 100644 (file)
@@ -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;