Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpthread In pthread__deliver_signal(), correctly use p...
details: https://anonhg.NetBSD.org/src/rev/bdc7d0ada440
branches: trunk
changeset: 550834:bdc7d0ada440
user: nathanw <nathanw%NetBSD.org@localhost>
date: Fri Aug 22 17:35:52 2003 +0000
description:
In pthread__deliver_signal(), correctly use pt_trapuc or pt_uc as the
context-to-restore instead of always using pt_uc.
Fixes a problem with signal handlers for synchronous signals noted by
Matthias Drochner on current-users.
diffstat:
lib/libpthread/pthread_sig.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r 49d134d7b97f -r bdc7d0ada440 lib/libpthread/pthread_sig.c
--- a/lib/libpthread/pthread_sig.c Fri Aug 22 16:01:12 2003 +0000
+++ b/lib/libpthread/pthread_sig.c Fri Aug 22 17:35:52 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_sig.c,v 1.16 2003/07/21 22:24:09 nathanw Exp $ */
+/* $NetBSD: pthread_sig.c,v 1.17 2003/08/22 17:35:52 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.16 2003/07/21 22:24:09 nathanw Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.17 2003/08/22 17:35:52 nathanw Exp $");
/* We're interposing a specific version of the signal interface. */
#define __LIBC12_SOURCE__
@@ -800,7 +800,7 @@
pthread__deliver_signal(pthread_t self, pthread_t target, int sig, int code)
{
sigset_t oldmask, *maskp;
- ucontext_t *uc;
+ ucontext_t *uc, *olduc;
struct sigaction act;
pthread_spinlock(self, &pt_sigacts_lock);
@@ -815,6 +815,11 @@
__sigplusset(&target->pt_sigmask, &act.sa_mask);
__sigaddset14(&target->pt_sigmask, sig);
+ if (target->pt_trapuc) {
+ olduc = target->pt_trapuc;
+ target->pt_trapuc = NULL;
+ } else
+ olduc = target->pt_uc;
/*
* We'd like to just pass oldmask to the
* pthread__signal_tramp(), but makecontext() can't reasonably
@@ -823,7 +828,7 @@
* handler. So we borrow a bit of space from the target's
* stack, which we were adjusting anyway.
*/
- maskp = (sigset_t *)(void *)((char *)(void *)target->pt_uc -
+ maskp = (sigset_t *)(void *)((char *)(void *)olduc -
STACKSPACE - sizeof(sigset_t));
*maskp = oldmask;
@@ -844,7 +849,7 @@
SDPRINTF(("(makecontext %p): target %p: sig: %d %d uc: %p oldmask: %08x\n",
self, target, sig, code, target->pt_uc, maskp->__bits[0]));
makecontext(uc, pthread__signal_tramp, 5,
- sig, code, act.sa_handler, target->pt_uc, maskp);
+ sig, code, act.sa_handler, olduc, maskp);
target->pt_uc = uc;
}
Home |
Main Index |
Thread Index |
Old Index