Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Undo previous. In pthread__deliver_signal set...



details:   https://anonhg.NetBSD.org/src/rev/7c01c40f9d42
branches:  trunk
changeset: 555545:7c01c40f9d42
user:      uwe <uwe%NetBSD.org@localhost>
date:      Thu Nov 20 17:16:41 2003 +0000

description:
Undo previous. In pthread__deliver_signal set uc->uc_stack.ss_sp = uc;
(as it used to be before 1.1.2.12) so that makecontext doesn't stomp
on the data we allocated on the stack.  Correct the debugging printf
to print olduc instead of target->pt_uc (we have pt_trapuc now, and
olduc can be pt_trapuc).

diffstat:

 lib/libpthread/pthread_sig.c |  18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diffs (56 lines):

diff -r c72cf31c4214 -r 7c01c40f9d42 lib/libpthread/pthread_sig.c
--- a/lib/libpthread/pthread_sig.c      Thu Nov 20 16:21:48 2003 +0000
+++ b/lib/libpthread/pthread_sig.c      Thu Nov 20 17:16:41 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_sig.c,v 1.25 2003/11/20 15:46:42 yamt Exp $    */
+/*     $NetBSD: pthread_sig.c,v 1.26 2003/11/20 17:16:41 uwe Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.25 2003/11/20 15:46:42 yamt Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.26 2003/11/20 17:16:41 uwe Exp $");
 
 /* We're interposing a specific version of the signal interface. */
 #define        __LIBC12_SOURCE__
@@ -867,30 +867,30 @@
         * handler. So we borrow a bit of space from the target's
         * stack, which we were adjusting anyway.
         */
-       siginfop = (siginfo_t *)(void *)((char *)(void *)olduc -
+       maskp = (sigset_t *)(void *)((char *)(void *)olduc -
+           STACKSPACE - sizeof(sigset_t));
+       *maskp = oldmask;
+       siginfop = (siginfo_t *)(void *)((char *)(void *)maskp -
            sizeof(*siginfop));
        *siginfop = *si;
-       maskp = (sigset_t *)(void *)((char *)(void *)siginfop -
-           STACKSPACE - sizeof(sigset_t));
-       *maskp = oldmask;
 
        /*
         * XXX We are blatantly ignoring SIGALTSTACK. It would screw
         * with our notion of stack->thread mappings.
         */
-       uc = (ucontext_t *)(void *)((char *)(void *)maskp -
+       uc = (ucontext_t *)(void *)((char *)(void *)siginfop -
            sizeof(ucontext_t));
 #ifdef _UC_UCONTEXT_ALIGN
        uc = (ucontext_t *)((uintptr_t)uc & _UC_UCONTEXT_ALIGN);
 #endif
 
        _INITCONTEXT_U(uc);
-       uc->uc_stack.ss_sp = maskp;
+       uc->uc_stack.ss_sp = uc;
        uc->uc_stack.ss_size = 0;
        uc->uc_link = NULL;
 
        SDPRINTF(("(makecontext %p): target %p: sig: %d uc: %p oldmask: %08x\n",
-           self, target, si->si_signo, target->pt_uc, maskp->__bits[0]));
+           self, target, si->si_signo, olduc, maskp->__bits[0]));
        makecontext(uc, pthread__signal_tramp, 3, act.sa_handler, siginfop,
            olduc);
        target->pt_uc = uc;



Home | Main Index | Thread Index | Old Index