From 71771abcbf45c58af4735979b21a2e7604cb42bf Mon Sep 17 00:00:00 2001 From: Philip Guenthe Date: Fri, 15 Apr 2011 04:52:41 +0000 Subject: Correct the sharing of the signal handling state: stuff that should be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@ --- sys/arch/i386/i386/linux_machdep.c | 14 +++++++------- sys/arch/i386/i386/machdep.c | 14 +++++++------- sys/arch/i386/i386/svr4_machdep.c | 16 ++++++++-------- sys/arch/i386/i386/vm86.c | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'sys/arch/i386') diff --git a/sys/arch/i386/i386/linux_machdep.c b/sys/arch/i386/i386/linux_machdep.c index 23a4ab92f7c..63694f4fea5 100644 --- a/sys/arch/i386/i386/linux_machdep.c +++ b/sys/arch/i386/i386/linux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_machdep.c,v 1.37 2011/04/05 13:54:42 pirofti Exp $ */ +/* $OpenBSD: linux_machdep.c,v 1.38 2011/04/15 04:52:39 guenther Exp $ */ /* $NetBSD: linux_machdep.c,v 1.29 1996/05/03 19:42:11 christos Exp $ */ /* @@ -114,16 +114,16 @@ linux_sendsig(sig_t catcher, int sig, int mask, u_long code, int type, int oonstack; tf = p->p_md.md_regs; - oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; + oonstack = p->p_sigstk.ss_flags & SS_ONSTACK; /* * Allocate space for the signal handler context. */ - if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack && + if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 && !oonstack && (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct linux_sigframe *)((char *)psp->ps_sigstk.ss_sp + - psp->ps_sigstk.ss_size - sizeof(struct linux_sigframe)); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; + fp = (struct linux_sigframe *)((char *)p->p_sigstk.ss_sp + + p->p_sigstk.ss_size - sizeof(struct linux_sigframe)); + p->p_sigstk.ss_flags |= SS_ONSTACK; } else { fp = (struct linux_sigframe *)tf->tf_esp - 1; } @@ -257,7 +257,7 @@ linux_sys_sigreturn(struct proc *p, void *v, register_t *retval) tf->tf_esp = context.sc_esp_at_signal; tf->tf_ss = context.sc_ss; - p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; + p->p_sigstk.ss_flags &= ~SS_ONSTACK; p->p_sigmask = context.sc_mask & ~sigcantmask; return (EJUSTRETURN); diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 8a82fac962b..679b6dffb53 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.489 2011/03/20 21:44:08 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.490 2011/04/15 04:52:39 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2189,7 +2189,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, struct sigframe *fp, frame; struct sigacts *psp = p->p_sigacts; register_t sp; - int oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; + int oonstack = p->p_sigstk.ss_flags & SS_ONSTACK; /* * Build the argument list for the signal handler. @@ -2199,10 +2199,10 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, /* * Allocate space for the signal handler context. */ - if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack && + if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 && !oonstack && (psp->ps_sigonstack & sigmask(sig))) { - sp = (long)psp->ps_sigstk.ss_sp + psp->ps_sigstk.ss_size; - psp->ps_sigstk.ss_flags |= SS_ONSTACK; + sp = (long)p->p_sigstk.ss_sp + p->p_sigstk.ss_size; + p->p_sigstk.ss_flags |= SS_ONSTACK; } else sp = tf->tf_esp; @@ -2377,9 +2377,9 @@ sys_sigreturn(struct proc *p, void *v, register_t *retval) } if (context.sc_onstack & 01) - p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK; + p->p_sigstk.ss_flags |= SS_ONSTACK; else - p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; + p->p_sigstk.ss_flags &= ~SS_ONSTACK; p->p_sigmask = context.sc_mask & ~sigcantmask; return (EJUSTRETURN); diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index 8d33252061d..388e5087123 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_machdep.c,v 1.26 2008/03/18 14:29:25 kettenis Exp $ */ +/* $OpenBSD: svr4_machdep.c,v 1.27 2011/04/15 04:52:39 guenther Exp $ */ /* $NetBSD: svr4_machdep.c,v 1.24 1996/05/03 19:42:26 christos Exp $ */ /* @@ -66,7 +66,7 @@ svr4_getcontext(struct proc *p, struct svr4_ucontext *uc, int mask, struct sigacts *psp = p->p_sigacts; svr4_greg_t *r = uc->uc_mcontext.greg; struct svr4_sigaltstack *s = &uc->uc_stack; - struct sigaltstack *sf = &psp->ps_sigstk; + struct sigaltstack *sf = &p->p_sigstk; bzero(uc, sizeof(struct svr4_ucontext)); @@ -138,7 +138,7 @@ svr4_setcontext(struct proc *p, struct svr4_ucontext *uc) struct trapframe *tf; svr4_greg_t *r = uc->uc_mcontext.greg; struct svr4_sigaltstack *s = &uc->uc_stack; - struct sigaltstack *sf = &psp->ps_sigstk; + struct sigaltstack *sf = &p->p_sigstk; int mask; /* @@ -316,16 +316,16 @@ svr4_sendsig(sig_t catcher, int sig, int mask, u_long code, int type, int oonstack; tf = p->p_md.md_regs; - oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; + oonstack = p->p_sigstk.ss_flags & SS_ONSTACK; /* * Allocate space for the signal handler context. */ - if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack && + if ((p->p_sigstk.ss_flags & SS_DISABLE) == 0 && !oonstack && (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct svr4_sigframe *)((char *)psp->ps_sigstk.ss_sp + - psp->ps_sigstk.ss_size - sizeof(struct svr4_sigframe)); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; + fp = (struct svr4_sigframe *)((char *)p->p_sigstk.ss_sp + + p->p_sigstk.ss_size - sizeof(struct svr4_sigframe)); + p->p_sigstk.ss_flags |= SS_ONSTACK; } else { fp = (struct svr4_sigframe *)tf->tf_esp - 1; } diff --git a/sys/arch/i386/i386/vm86.c b/sys/arch/i386/i386/vm86.c index e79eb1d60b6..8c2b1aca73e 100644 --- a/sys/arch/i386/i386/vm86.c +++ b/sys/arch/i386/i386/vm86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm86.c,v 1.18 2008/06/26 05:42:10 ray Exp $ */ +/* $OpenBSD: vm86.c,v 1.19 2011/04/15 04:52:39 guenther Exp $ */ /* $NetBSD: vm86.c,v 1.15 1996/05/03 19:42:33 christos Exp $ */ /*- @@ -427,7 +427,7 @@ i386_vm86(struct proc *p, char *args, register_t *retval) #undef DOREG /* Going into vm86 mode jumps off the signal stack. */ - p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK; + p->p_sigstk.ss_flags &= ~SS_ONSTACK; set_vflags(p, vm86s.regs.vmsc.sc_eflags | PSL_VM); -- cgit v1.2.3