* [Qemu-devel] [PATCH] cpus.c: Use pthread_sigmask() rather than sigprocmask()
@ 2016-05-16 17:33 Peter Maydell
2016-05-16 17:37 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2016-05-16 17:33 UTC (permalink / raw)
To: qemu-devel; +Cc: patches, Paolo Bonzini, Richard Henderson
On Linux, sigprocmask() and pthread_sigmask() are in practice the
same thing (they only set the signal mask for the calling thread),
but the documentation states that the behaviour of sigprocmask() in a
multithreaded process is undefined. Use pthread_sigmask() instead
(which is what we do in almost all places in QEMU that alter the
signal mask already).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
cpus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index cbeb1f6..1d0fc53 100644
--- a/cpus.c
+++ b/cpus.c
@@ -778,7 +778,7 @@ static void sigbus_reraise(void)
raise(SIGBUS);
sigemptyset(&set);
sigaddset(&set, SIGBUS);
- sigprocmask(SIG_UNBLOCK, &set, NULL);
+ pthread_sigmask(SIG_UNBLOCK, &set, NULL);
}
perror("Failed to re-raise SIGBUS!\n");
abort();
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] cpus.c: Use pthread_sigmask() rather than sigprocmask()
2016-05-16 17:33 [Qemu-devel] [PATCH] cpus.c: Use pthread_sigmask() rather than sigprocmask() Peter Maydell
@ 2016-05-16 17:37 ` Peter Maydell
2016-05-17 9:55 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2016-05-16 17:37 UTC (permalink / raw)
To: QEMU Developers; +Cc: Paolo Bonzini, Richard Henderson, Patch Tracking
On 16 May 2016 at 18:33, Peter Maydell <peter.maydell@linaro.org> wrote:
> On Linux, sigprocmask() and pthread_sigmask() are in practice the
> same thing (they only set the signal mask for the calling thread),
> but the documentation states that the behaviour of sigprocmask() in a
> multithreaded process is undefined. Use pthread_sigmask() instead
> (which is what we do in almost all places in QEMU that alter the
> signal mask already).
The only other sigprocmask() uses are in linux-user, apart from
a couple in net/tap.c, where they're used as part of forking and
spawning the helper process. I suspect this should be using
qemu_fork() instead of doing it all by hand, wrongly...
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] cpus.c: Use pthread_sigmask() rather than sigprocmask()
2016-05-16 17:37 ` Peter Maydell
@ 2016-05-17 9:55 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2016-05-17 9:55 UTC (permalink / raw)
To: Peter Maydell, QEMU Developers; +Cc: Richard Henderson, Patch Tracking
On 16/05/2016 19:37, Peter Maydell wrote:
> The only other sigprocmask() uses are in linux-user, apart from
> a couple in net/tap.c, where they're used as part of forking and
> spawning the helper process. I suspect this should be using
> qemu_fork() instead of doing it all by hand, wrongly...
In all fairness those predate qemu_fork(). :)
Your patch also changes a Linux-only function, but it's cleaner to user
pthread_sigmask so I've queued it for the next pull request.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-17 9:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-16 17:33 [Qemu-devel] [PATCH] cpus.c: Use pthread_sigmask() rather than sigprocmask() Peter Maydell
2016-05-16 17:37 ` Peter Maydell
2016-05-17 9:55 ` Paolo Bonzini
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).