qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sigfd: use pthread_sigmask
@ 2011-06-08 22:55 Alexander Graf
  2011-06-08 23:19 ` Alexandre Raymond
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Alexander Graf @ 2011-06-08 22:55 UTC (permalink / raw)
  To: qemu-devel Developers; +Cc: Paolo Bonzini, Andreas Färber, 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 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>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Jan Kiszka <jan.kiszka@siemens.com>
CC: Anthony Liguori <anthony@codemonkey.ws>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-10 21:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 22:55 [Qemu-devel] [PATCH] sigfd: use pthread_sigmask Alexander Graf
2011-06-08 23:19 ` Alexandre Raymond
2011-06-09  5:59 ` Paolo Bonzini
2011-06-09  6:51 ` Jan Kiszka
2011-06-09 12:36 ` Andreas Färber
2011-06-09 15:14   ` Andreas Färber
2011-06-10 21:22 ` Edgar E. Iglesias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).