From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUZ67-0004tI-6h for qemu-devel@nongnu.org; Thu, 09 Jun 2011 02:52:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUZ63-0007re-P8 for qemu-devel@nongnu.org; Thu, 09 Jun 2011 02:52:06 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:47645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUZ63-0007r7-4D for qemu-devel@nongnu.org; Thu, 09 Jun 2011 02:52:03 -0400 Message-ID: <4DF06D87.6000208@web.de> Date: Thu, 09 Jun 2011 08:51:51 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1307573737-33421-1-git-send-email-agraf@suse.de> In-Reply-To: <1307573737-33421-1-git-send-email-agraf@suse.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig20E7ACB2D01B1C5C1A07F7E7" Sender: jan.kiszka@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: Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel Developers This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig20E7ACB2D01B1C5C1A07F7E7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2011-06-09 00:55, 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 rec= eive > its news. >=20 > 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. >=20 > This all sounds great, but what we're really doing is: >=20 > sigset_t all; >=20 > sigfillset(&all); > sigprocmask(SIG_BLOCK, &all, NULL); >=20 > which - on Darwin - blocks all signals on the current _process_, not on= ly > on the current thread. To block signals on the thread, we can use > pthread_sigmask(). >=20 > This patch does that, assuming that my above analysis is correct, and t= hus > renders Qemu useable on Darwin again. >=20 > 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(-) >=20 > 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; Makes a lot of sense. And it also effects pre-signalfd Linux (<2.6.27). Acked-by: Jan Kiszka --------------enig20E7ACB2D01B1C5C1A07F7E7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iEYEARECAAYFAk3wbY8ACgkQitSsb3rl5xQj1ACbBzwPk77aa8GkNxnc019CQUEZ UNoAoIeyHJ8wPBXYbinwXBXISzC4pWb0 =O90e -----END PGP SIGNATURE----- --------------enig20E7ACB2D01B1C5C1A07F7E7--