Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread pthread__deliver_signal: swap oldmask and sig...



details:   https://anonhg.NetBSD.org/src/rev/b4daa430fc78
branches:  trunk
changeset: 555539:b4daa430fc78
user:      yamt <yamt%NetBSD.org@localhost>
date:      Thu Nov 20 15:46:42 2003 +0000

description:
pthread__deliver_signal: swap oldmask and siginfo so that signal
handler's stack doesn't stomp siginfo.
this also fixes !__HAVE_SIGINFO, in that case
pthread__signal_tramp assumes uc->uc_stack.ss_sp points the old
signal mask.

pointed by uwe@.

diffstat:

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

diffs (42 lines):

diff -r d6c545fbd338 -r b4daa430fc78 lib/libpthread/pthread_sig.c
--- a/lib/libpthread/pthread_sig.c      Thu Nov 20 15:42:16 2003 +0000
+++ b/lib/libpthread/pthread_sig.c      Thu Nov 20 15:46:42 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_sig.c,v 1.24 2003/11/09 18:56:48 christos Exp $        */
+/*     $NetBSD: pthread_sig.c,v 1.25 2003/11/20 15:46:42 yamt Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sig.c,v 1.24 2003/11/09 18:56:48 christos Exp $");
+__RCSID("$NetBSD: pthread_sig.c,v 1.25 2003/11/20 15:46:42 yamt Exp $");
 
 /* We're interposing a specific version of the signal interface. */
 #define        __LIBC12_SOURCE__
@@ -867,18 +867,18 @@
         * handler. So we borrow a bit of space from the target's
         * stack, which we were adjusting anyway.
         */
-       maskp = (sigset_t *)(void *)((char *)(void *)olduc -
+       siginfop = (siginfo_t *)(void *)((char *)(void *)olduc -
+           sizeof(*siginfop));
+       *siginfop = *si;
+       maskp = (sigset_t *)(void *)((char *)(void *)siginfop -
            STACKSPACE - sizeof(sigset_t));
        *maskp = oldmask;
-       siginfop = (siginfo_t *)(void *)((char *)(void *)maskp -
-           sizeof(*siginfop));
-       *siginfop = *si;
 
        /*
         * XXX We are blatantly ignoring SIGALTSTACK. It would screw
         * with our notion of stack->thread mappings.
         */
-       uc = (ucontext_t *)(void *)((char *)(void *)siginfop -
+       uc = (ucontext_t *)(void *)((char *)(void *)maskp -
            sizeof(ucontext_t));
 #ifdef _UC_UCONTEXT_ALIGN
        uc = (ucontext_t *)((uintptr_t)uc & _UC_UCONTEXT_ALIGN);



Home | Main Index | Thread Index | Old Index