From owner-p4-projects@FreeBSD.ORG Tue May 13 13:49:32 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1FC5037B404; Tue, 13 May 2003 13:49:31 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A80CD37B401 for ; Tue, 13 May 2003 13:49:30 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9931343FB1 for ; Tue, 13 May 2003 13:49:29 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h4DKnT0U045632 for ; Tue, 13 May 2003 13:49:29 -0700 (PDT) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h4DKnS2T045629 for perforce@freebsd.org; Tue, 13 May 2003 13:49:28 -0700 (PDT) Date: Tue, 13 May 2003 13:49:28 -0700 (PDT) Message-Id: <200305132049.h4DKnS2T045629@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Subject: PERFORCE change 31093 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2003 20:49:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=31093 Change 31093 by jhb@jhb_laptop on 2003/05/13 13:49:26 IFC @31091 (loop back sigacts locking). Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/machdep.c#56 integrate .. //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#20 integrate .. //depot/projects/smpng/sys/amd64/amd64/machdep.c#4 integrate .. //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#27 integrate .. //depot/projects/smpng/sys/compat/svr4/svr4_filio.c#11 integrate .. //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#24 integrate .. //depot/projects/smpng/sys/dev/acpica/Osd/OsdHardware.c#8 integrate .. //depot/projects/smpng/sys/dev/acpica/acpivar.h#25 integrate .. //depot/projects/smpng/sys/i386/acpica/acpi_machdep.c#8 integrate .. //depot/projects/smpng/sys/i386/acpica/acpi_wakeup.c#15 integrate .. //depot/projects/smpng/sys/i386/i386/machdep.c#59 integrate .. //depot/projects/smpng/sys/i386/linux/linux_sysvec.c#32 integrate .. //depot/projects/smpng/sys/i386/svr4/svr4_machdep.c#12 integrate .. //depot/projects/smpng/sys/ia64/ia64/machdep.c#54 integrate .. //depot/projects/smpng/sys/kern/init_main.c#34 integrate .. //depot/projects/smpng/sys/kern/kern_condvar.c#28 integrate .. //depot/projects/smpng/sys/kern/kern_exec.c#57 integrate .. //depot/projects/smpng/sys/kern/kern_exit.c#65 integrate .. //depot/projects/smpng/sys/kern/kern_fork.c#60 integrate .. //depot/projects/smpng/sys/kern/kern_kthread.c#12 integrate .. //depot/projects/smpng/sys/kern/kern_proc.c#52 integrate .. //depot/projects/smpng/sys/kern/kern_sig.c#67 integrate .. //depot/projects/smpng/sys/kern/kern_synch.c#49 integrate .. //depot/projects/smpng/sys/kern/kern_time.c#23 integrate .. //depot/projects/smpng/sys/kern/subr_trap.c#53 integrate .. //depot/projects/smpng/sys/kern/tty.c#34 integrate .. //depot/projects/smpng/sys/kern/tty_pty.c#22 integrate .. //depot/projects/smpng/sys/netncp/ncp_ncp.c#8 integrate .. //depot/projects/smpng/sys/netsmb/smb_subr.c#12 integrate .. //depot/projects/smpng/sys/nfsclient/nfs_socket.c#18 integrate .. //depot/projects/smpng/sys/pc98/i386/machdep.c#53 integrate .. //depot/projects/smpng/sys/powerpc/powerpc/machdep.c#38 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#50 integrate .. //depot/projects/smpng/sys/sys/proc.h#86 integrate .. //depot/projects/smpng/sys/sys/signalvar.h#16 integrate .. //depot/projects/smpng/sys/sys/user.h#15 integrate .. //depot/projects/smpng/sys/vm/vm_glue.c#27 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/machdep.c#56 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.201 2003/04/25 01:50:28 deischen Exp $ + * $FreeBSD: src/sys/alpha/alpha/machdep.c,v 1.202 2003/05/13 20:35:56 jhb Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1133,11 +1133,13 @@ td = curthread; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + frame = td->td_frame; - oonstack = sigonstack(alpha_pal_rdusp()); fsize = sizeof ksi; rndfsize = ((fsize + 15) / 16) * 16; - psp = p->p_sigacts; + oonstack = sigonstack(alpha_pal_rdusp()); /* * Allocate and validate space for the signal handler @@ -1155,6 +1157,7 @@ #endif } else sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -1210,7 +1213,8 @@ frame->tf_regs[FRAME_A0] = sig; frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) + mtx_lock(&psp->ps_mtx); + if (SIGISMEMBER(psp->ps_siginfo, sig)) frame->tf_regs[FRAME_A1] = (u_int64_t)sip; else frame->tf_regs[FRAME_A1] = code; @@ -1235,6 +1239,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); frame = td->td_frame; oonstack = sigonstack(alpha_pal_rdusp()); @@ -1276,6 +1281,7 @@ #endif } else sfp = (struct sigframe4 *)(alpha_pal_rdusp() - rndfsize); + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* save the floating-point state, if necessary, then copy it. */ @@ -1311,7 +1317,8 @@ frame->tf_regs[FRAME_PC] = PS_STRINGS - szfreebsd4_sigcode; frame->tf_regs[FRAME_A0] = sig; PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + mtx_lock(&psp->ps_mtx); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { frame->tf_regs[FRAME_A1] = (u_int64_t)&(sfp->sf_si); /* Fill in POSIX parts */ @@ -1343,6 +1350,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); #ifdef COMPAT_FREEBSD4 if (SIGISMEMBER(psp->ps_freebsd4, sig)) { freebsd4_sendsig(catcher, sig, mask, code); @@ -1397,6 +1405,7 @@ #endif } else sfp = (struct sigframe *)(alpha_pal_rdusp() - rndfsize); + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* save the floating-point state, if necessary, then copy it. */ @@ -1432,7 +1441,8 @@ frame->tf_regs[FRAME_PC] = PS_STRINGS - szsigcode; frame->tf_regs[FRAME_A0] = sig; PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + mtx_lock(&psp->ps_mtx); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { frame->tf_regs[FRAME_A1] = (u_int64_t)&(sfp->sf_si); /* Fill in POSIX parts */ ==== //depot/projects/smpng/sys/alpha/osf1/osf1_signal.c#20 (text+ko) ==== @@ -30,7 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/alpha/osf1/osf1_signal.c,v 1.32 2003/04/29 06:33:03 alc Exp $ + * $FreeBSD: src/sys/alpha/osf1/osf1_signal.c,v 1.33 2003/05/13 20:35:56 jhb Exp $ */ #include "opt_compat.h" @@ -471,6 +471,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); frame = td->td_frame; oonstack = sigonstack(alpha_pal_rdusp()); @@ -490,6 +491,7 @@ p->p_sigstk.ss_flags |= SS_ONSTACK; } else sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -551,6 +553,7 @@ frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ alpha_pal_wrusp((unsigned long)sip); PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } ==== //depot/projects/smpng/sys/amd64/amd64/machdep.c#4 (text+ko) ==== @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.575 2003/05/12 18:37:56 peter Exp $ + * $FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.576 2003/05/13 20:35:57 jhb Exp $ */ #include "opt_atalk.h" @@ -235,6 +235,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); regs = td->td_frame; oonstack = sigonstack(regs->tf_rsp); @@ -262,7 +263,6 @@ sp = (char *)regs->tf_rsp - sizeof(struct sigframe) - 128; /* Align to 16 bytes. */ sfp = (struct sigframe *)((unsigned long)sp & ~0xF); - PROC_UNLOCK(p); /* Translate the signal if appropriate. */ if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) @@ -271,8 +271,7 @@ /* Build the argument list for the signal handler. */ regs->tf_rdi = sig; /* arg 1 in %rdi */ regs->tf_rdx = (register_t)&sfp->sf_uc; /* arg 3 in %rdx */ - PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ regs->tf_rsi = (register_t)&sfp->sf_si; /* arg 2 in %rsi */ sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; @@ -287,6 +286,7 @@ regs->tf_rcx = regs->tf_addr; /* arg 4 in %rcx */ sf.sf_ahu.sf_handler = catcher; } + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -305,6 +305,7 @@ regs->tf_rflags &= ~PSL_T; regs->tf_cs = _ucodesel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } /* ==== //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#27 (text+ko) ==== @@ -38,7 +38,7 @@ * * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 * - * $FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.64 2003/04/17 21:58:45 jhb Exp $ + * $FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.65 2003/05/13 20:35:57 jhb Exp $ */ #include @@ -547,6 +547,7 @@ char *state; segsz_t lsize; struct thread *td2; + struct sigacts *ps; int i; PROC_LOCK(p); @@ -653,8 +654,11 @@ * relation to struct proc, so SigBlk is left unimplemented. */ sbuf_printf(sb, "SigBlk:\t%08x\n", 0); /* XXX */ - sbuf_printf(sb, "SigIgn:\t%08x\n", p->p_sigignore.__bits[0]); - sbuf_printf(sb, "SigCgt:\t%08x\n", p->p_sigcatch.__bits[0]); + ps = p->p_sigacts; + mtx_lock(&ps->ps_mtx); + sbuf_printf(sb, "SigIgn:\t%08x\n", ps->ps_sigignore.__bits[0]); + sbuf_printf(sb, "SigCgt:\t%08x\n", ps->ps_sigcatch.__bits[0]); + mtx_unlock(&ps->ps_mtx); PROC_UNLOCK(p); /* ==== //depot/projects/smpng/sys/compat/svr4/svr4_filio.c#11 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/svr4/svr4_filio.c,v 1.27 2003/03/31 22:49:14 jeff Exp $ + * $FreeBSD: src/sys/compat/svr4/svr4_filio.c,v 1.28 2003/05/13 20:35:57 jhb Exp $ */ #include @@ -132,10 +132,21 @@ DPRINTF(("svr4_read(%d, 0x%0x, %d) = %d\n", uap->fd, uap->buf, uap->nbyte, rv)); if (rv == EAGAIN) { +#ifdef DEBUG_SVR4 + struct sigacts *ps; + + PROC_LOCK(td->td_proc); + ps = td->td_proc->p_sigacts; + mtx_lock(&ps->ps_mtx); +#endif DPRINTF(("sigmask = 0x%x\n", td->td_sigmask)); - DPRINTF(("sigignore = 0x%x\n", td->td_proc->p_sigignore)); - DPRINTF(("sigcaught = 0x%x\n", td->td_proc->p_sigcatch)); + DPRINTF(("sigignore = 0x%x\n", ps->ps_sigignore)); + DPRINTF(("sigcaught = 0x%x\n", ps->ps_sigcatch)); DPRINTF(("siglist = 0x%x\n", td->td_siglist)); +#ifdef DEBUG_SVR4 + mtx_unlock(&ps->ps_mtx); + PROC_UNLOCK(td->td_proc); +#endif } #if defined(GROTTY_READ_HACK) ==== //depot/projects/smpng/sys/compat/svr4/svr4_misc.c#24 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.62 2003/04/17 22:09:08 jhb Exp $ + * $FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.63 2003/05/13 20:35:57 jhb Exp $ */ /* @@ -1363,12 +1363,8 @@ sx_xunlock(&proctree_lock); PROC_LOCK(q); - if (--q->p_procsig->ps_refcnt == 0) { - if (q->p_sigacts != &q->p_uarea->u_sigacts) - FREE(q->p_sigacts, M_SUBPROC); - FREE(q->p_procsig, M_SUBPROC); - q->p_procsig = NULL; - } + sigacts_free(q->p_sigacts); + q->p_sigacts = NULL; PROC_UNLOCK(q); /* ==== //depot/projects/smpng/sys/dev/acpica/Osd/OsdHardware.c#8 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.7 2003/05/12 16:54:55 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/Osd/OsdHardware.c,v 1.8 2003/05/13 16:59:46 jhb Exp $ */ /* @@ -36,7 +36,11 @@ #include #include #include +#if __FreeBSD_version >= 500000 #include +#else +#include +#endif /* * ACPICA's rather gung-ho approach to hardware resource ownership is a little ==== //depot/projects/smpng/sys/dev/acpica/acpivar.h#25 (text+ko) ==== @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.40 2003/04/29 18:50:33 njl Exp $ + * $FreeBSD: src/sys/dev/acpica/acpivar.h,v 1.41 2003/05/13 16:59:46 jhb Exp $ */ #include "bus_if.h" @@ -39,6 +39,10 @@ #include #include +#if __FreeBSD_version < 500000 +typedef vm_offset_t vm_paddr_t; +#endif + struct acpi_softc { device_t acpi_dev; dev_t acpi_dev_t; @@ -389,12 +393,14 @@ extern int acpi_acad_get_acline(int *); +#if __FreeBSD_version >= 500000 #ifndef ACPI_MAX_THREADS #define ACPI_MAX_THREADS 3 #endif #if ACPI_MAX_THREADS > 0 #define ACPI_USE_THREADS #endif +#endif #ifdef ACPI_USE_THREADS /* ==== //depot/projects/smpng/sys/i386/acpica/acpi_machdep.c#8 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.8 2003/03/24 19:14:45 mdodd Exp $ + * $FreeBSD: src/sys/i386/acpica/acpi_machdep.c,v 1.9 2003/05/13 16:59:46 jhb Exp $ */ #include @@ -52,7 +52,11 @@ #include #include +#if __FreeBSD_version < 500000 +#include +#else #include +#endif static struct apm_softc apm_softc; ==== //depot/projects/smpng/sys/i386/acpica/acpi_wakeup.c#15 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/acpica/acpi_wakeup.c,v 1.18 2003/03/25 00:07:01 jake Exp $ + * $FreeBSD: src/sys/i386/acpica/acpi_wakeup.c,v 1.19 2003/05/13 16:59:46 jhb Exp $ */ #include @@ -58,6 +58,11 @@ #include "acpi_wakecode.h" +#if __FreeBSD_version < 500000 +#define vm_page_lock_queues() +#define vm_page_unlock_queues() +#endif + extern void initializecpu(void); static struct region_descriptor r_idt, r_gdt, *p_gdt; ==== //depot/projects/smpng/sys/i386/i386/machdep.c#59 (text+ko) ==== @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.563 2003/04/25 01:50:28 deischen Exp $ + * $FreeBSD: src/sys/i386/i386/machdep.c,v 1.564 2003/05/13 20:35:58 jhb Exp $ */ #include "opt_atalk.h" @@ -295,6 +295,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); regs = td->td_frame; oonstack = sigonstack(regs->tf_esp); @@ -308,7 +309,6 @@ #endif } else fp = (struct osigframe *)regs->tf_esp - 1; - PROC_UNLOCK(p); /* Translate the signal if appropriate. */ if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) @@ -317,8 +317,7 @@ /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_scp = (register_t)&fp->sf_siginfo.si_sc; - PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_arg2 = (register_t)&fp->sf_siginfo; sf.sf_siginfo.si_signo = sig; @@ -330,6 +329,7 @@ sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* Save most if not all of trap frame. */ @@ -402,6 +402,7 @@ load_gs(_udatasel); regs->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } #endif /* COMPAT_43 */ @@ -424,6 +425,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); regs = td->td_frame; oonstack = sigonstack(regs->tf_esp); @@ -447,7 +449,6 @@ #endif } else sfp = (struct sigframe4 *)regs->tf_esp - 1; - PROC_UNLOCK(p); /* Translate the signal if appropriate. */ if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) @@ -456,8 +457,7 @@ /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_ucontext = (register_t)&sfp->sf_uc; - PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_siginfo = (register_t)&sfp->sf_si; sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; @@ -472,6 +472,7 @@ sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -523,6 +524,7 @@ regs->tf_fs = _udatasel; regs->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } #endif /* COMPAT_FREEBSD4 */ @@ -545,6 +547,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); #ifdef COMPAT_FREEBSD4 if (SIGISMEMBER(psp->ps_freebsd4, sig)) { freebsd4_sendsig(catcher, sig, mask, code); @@ -585,7 +588,6 @@ sp = (char *)regs->tf_esp - sizeof(struct sigframe); /* Align to 16 bytes. */ sfp = (struct sigframe *)((unsigned int)sp & ~0xF); - PROC_UNLOCK(p); /* Translate the signal if appropriate. */ if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize) @@ -594,8 +596,7 @@ /* Build the argument list for the signal handler. */ sf.sf_signum = sig; sf.sf_ucontext = (register_t)&sfp->sf_uc; - PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ sf.sf_siginfo = (register_t)&sfp->sf_si; sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; @@ -610,6 +611,7 @@ sf.sf_addr = regs->tf_err; sf.sf_ahu.sf_handler = catcher; } + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -661,6 +663,7 @@ regs->tf_fs = _udatasel; regs->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } /* ==== //depot/projects/smpng/sys/i386/linux/linux_sysvec.c#32 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/linux/linux_sysvec.c,v 1.122 2003/05/11 21:51:11 mdodd Exp $ + * $FreeBSD: src/sys/i386/linux/linux_sysvec.c,v 1.123 2003/05/13 20:35:58 jhb Exp $ */ /* XXX we use functions that might not exist. */ @@ -268,11 +268,14 @@ { struct thread *td = curthread; struct proc *p = td->td_proc; + struct sigacts *psp; struct trapframe *regs; struct l_rt_sigframe *fp, frame; int oonstack; PROC_LOCK_ASSERT(p, MA_OWNED); + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); regs = td->td_frame; oonstack = sigonstack(regs->tf_esp); @@ -285,11 +288,12 @@ * Allocate space for the signal handler context. */ if ((p->p_flag & P_ALTSTACK) && !oonstack && - SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) { + SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_rt_sigframe *)(p->p_sigstk.ss_sp + p->p_sigstk.ss_size - sizeof(struct l_rt_sigframe)); } else fp = (struct l_rt_sigframe *)regs->tf_esp - 1; + mtx_unlock(&psp->ps_mtx); /* * Build the argument list for the signal handler. @@ -378,6 +382,7 @@ regs->tf_fs = _udatasel; regs->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } @@ -396,13 +401,16 @@ { struct thread *td = curthread; struct proc *p = td->td_proc; + struct sigacts *psp; struct trapframe *regs; struct l_sigframe *fp, frame; l_sigset_t lmask; int oonstack, i; PROC_LOCK_ASSERT(p, MA_OWNED); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { /* Signal handler installed with SA_SIGINFO. */ linux_rt_sendsig(catcher, sig, mask, code); return; @@ -421,11 +429,12 @@ * Allocate space for the signal handler context. */ if ((p->p_flag & P_ALTSTACK) && !oonstack && - SIGISMEMBER(p->p_sigacts->ps_sigonstack, sig)) { + SIGISMEMBER(psp->ps_sigonstack, sig)) { fp = (struct l_sigframe *)(p->p_sigstk.ss_sp + p->p_sigstk.ss_size - sizeof(struct l_sigframe)); } else fp = (struct l_sigframe *)regs->tf_esp - 1; + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -489,6 +498,7 @@ regs->tf_fs = _udatasel; regs->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); } /* ==== //depot/projects/smpng/sys/i386/svr4/svr4_machdep.c#12 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/svr4/svr4_machdep.c,v 1.31 2003/04/17 22:19:47 jhb Exp $ + * $FreeBSD: src/sys/i386/svr4/svr4_machdep.c,v 1.32 2003/05/13 20:35:58 jhb Exp $ */ #include @@ -428,6 +428,7 @@ #endif PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); tf = td->td_frame; oonstack = sigonstack(tf->tf_esp); @@ -443,6 +444,7 @@ } else { fp = (struct svr4_sigframe *)tf->tf_esp - 1; } + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); /* @@ -505,6 +507,7 @@ load_gs(_udatasel); tf->tf_ss = _udatasel; PROC_LOCK(p); + mtx_lock(&psp->ps_mtx); #endif } ==== //depot/projects/smpng/sys/ia64/ia64/machdep.c#54 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.130 2003/05/02 20:34:15 marcel Exp $ + * $FreeBSD: src/sys/ia64/ia64/machdep.c,v 1.131 2003/05/13 20:35:58 jhb Exp $ */ #include "opt_compat.h" @@ -756,6 +756,7 @@ p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); psp = p->p_sigacts; + mtx_assert(&psp->ps_mtx, MA_OWNED); frame = td->td_frame; oonstack = sigonstack(frame->tf_r[FRAME_SP]); rndfsize = ((sizeof(sf) + 15) / 16) * 16; @@ -822,6 +823,7 @@ #endif } else sfp = (struct sigframe *)(frame->tf_r[FRAME_SP] - rndfsize); + mtx_unlock(&psp->ps_mtx); PROC_UNLOCK(p); #ifdef DEBUG @@ -870,7 +872,8 @@ frame->tf_cr_iip = PS_STRINGS - (esigcode - sigcode); frame->tf_r[FRAME_R1] = sig; PROC_LOCK(p); - if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { + mtx_lock(&psp->ps_mtx); + if (SIGISMEMBER(psp->ps_siginfo, sig)) { frame->tf_r[FRAME_R15] = (u_int64_t)&(sfp->sf_si); /* Fill in POSIX parts */ ==== //depot/projects/smpng/sys/kern/init_main.c#34 (text+ko) ==== @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 - * $FreeBSD: src/sys/kern/init_main.c,v 1.230 2003/05/01 16:59:22 des Exp $ + * $FreeBSD: src/sys/kern/init_main.c,v 1.231 2003/05/13 20:35:59 jhb Exp $ */ #include "opt_init_path.h" @@ -90,7 +90,6 @@ struct thread thread0; struct kse kse0; struct ksegrp ksegrp0; -static struct procsig procsig0; static struct filedesc0 filedesc0; static struct plimit limit0; struct vmspace vmspace0; @@ -399,9 +398,8 @@ #endif td->td_ucred = crhold(p->p_ucred); - /* Create procsig. */ - p->p_procsig = &procsig0; - p->p_procsig->ps_refcnt = 1; + /* Create sigacts. */ + p->p_sigacts = sigacts_alloc(); /* Initialize signal state for process 0. */ siginit(&proc0); @@ -441,11 +439,10 @@ vmspace0.vm_map.pmap = vmspace_pmap(&vmspace0); /* - * We continue to place resource usage info and signal - * actions in the user struct so they're pageable. + * We continue to place resource usage info + * in the user struct so that it's pageable. */ p->p_stats = &p->p_uarea->u_stats; - p->p_sigacts = &p->p_uarea->u_sigacts; /* * Charge root for one process. ==== //depot/projects/smpng/sys/kern/kern_condvar.c#28 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/kern/kern_condvar.c,v 1.40 2003/04/17 22:21:05 jhb Exp $ + * $FreeBSD: src/sys/kern/kern_condvar.c,v 1.41 2003/05/13 20:35:59 jhb Exp $ */ #include "opt_ktrace.h" @@ -146,7 +146,9 @@ mtx_unlock_spin(&sched_lock); p = td->td_proc; PROC_LOCK(p); + mtx_lock(&p->p_sigacts->ps_mtx); sig = cursig(td); + mtx_unlock(&p->p_sigacts->ps_mtx); if (thread_suspend_check(1)) sig = SIGSTOP; mtx_lock_spin(&sched_lock); @@ -283,6 +285,7 @@ mtx_unlock_spin(&sched_lock); PROC_LOCK(p); + mtx_lock(&p->p_sigacts->ps_mtx); if (sig == 0) sig = cursig(td); /* XXXKSE */ if (sig != 0) { @@ -291,6 +294,7 @@ else rval = ERESTART; } + mtx_unlock(&p->p_sigacts->ps_mtx); if (p->p_flag & P_WEXIT) rval = EINTR; PROC_UNLOCK(p); @@ -446,6 +450,7 @@ mtx_unlock_spin(&sched_lock); PROC_LOCK(p); + mtx_lock(&p->p_sigacts->ps_mtx); if (sig == 0) sig = cursig(td); if (sig != 0) { @@ -454,6 +459,7 @@ else rval = ERESTART; } + mtx_unlock(&p->p_sigacts->ps_mtx); if (p->p_flag & P_WEXIT) rval = EINTR; PROC_UNLOCK(p); ==== //depot/projects/smpng/sys/kern/kern_exec.c#57 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/kern/kern_exec.c,v 1.218 2003/04/01 01:26:20 jeff Exp $ + * $FreeBSD: src/sys/kern/kern_exec.c,v 1.219 2003/05/13 20:35:59 jhb Exp $ */ #include "opt_ktrace.h" @@ -163,7 +163,7 @@ struct vattr attr; int (*img_first)(struct image_params *); struct pargs *oldargs = NULL, *newargs = NULL; - struct procsig *oldprocsig, *newprocsig; + struct sigacts *oldsigacts, *newsigacts; #ifdef KTRACE struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; @@ -413,23 +413,16 @@ * reset. */ PROC_LOCK(p); - mp_fixme("procsig needs a lock"); - if (p->p_procsig->ps_refcnt > 1) { - oldprocsig = p->p_procsig; + if (sigacts_shared(p->p_sigacts)) { + oldsigacts = p->p_sigacts; PROC_UNLOCK(p); - MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, M_WAITOK); - bcopy(oldprocsig, newprocsig, sizeof(*newprocsig)); - newprocsig->ps_refcnt = 1; - oldprocsig->ps_refcnt--; + newsigacts = sigacts_alloc(); + sigacts_copy(newsigacts, oldsigacts); PROC_LOCK(p); - p->p_procsig = newprocsig; - if (p->p_sigacts == &p->p_uarea->u_sigacts) - panic("shared procsig but private sigacts?"); + p->p_sigacts = newsigacts; + } else + oldsigacts = NULL; - p->p_uarea->u_sigacts = *p->p_sigacts; - p->p_sigacts = &p->p_uarea->u_sigacts; - } /* Stop profiling */ stopprofclock(p); @@ -628,6 +621,8 @@ pargs_drop(oldargs); if (newargs != NULL) pargs_drop(newargs); + if (oldsigacts != NULL) + sigacts_free(oldsigacts); exec_fail_dealloc: ==== //depot/projects/smpng/sys/kern/kern_exit.c#65 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_exit.c 8.7 (Berkeley) 2/12/94 - * $FreeBSD: src/sys/kern/kern_exit.c,v 1.213 2003/05/01 21:16:38 jhb Exp $ + * $FreeBSD: src/sys/kern/kern_exit.c,v 1.214 2003/05/13 20:35:59 jhb Exp $ */ #include "opt_compat.h" @@ -431,9 +431,11 @@ * 1 instead (and hope it will handle this situation). */ PROC_LOCK(p->p_pptr); - if (p->p_pptr->p_procsig->ps_flag & (PS_NOCLDWAIT | PS_CLDSIGIGN)) { + mtx_lock(&p->p_pptr->p_sigacts->ps_mtx); + if (p->p_pptr->p_sigacts->ps_flag & (PS_NOCLDWAIT | PS_CLDSIGIGN)) { struct proc *pp; + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); pp = p->p_pptr; PROC_UNLOCK(pp); proc_reparent(p, initproc); @@ -445,7 +447,8 @@ */ if (LIST_EMPTY(&pp->p_children)) wakeup(pp); - } + } else + mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx); if (p->p_sigparent && p->p_pptr != initproc) psignal(p->p_pptr, p->p_sigparent); @@ -656,23 +659,14 @@ (void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0); /* - * Free up credentials. + * Free credentials, arguments, and sigacts */ crfree(p->p_ucred); - p->p_ucred = NULL; /* XXX: why? */ - - /* - * Remove unused arguments - */ + p->p_ucred = NULL; pargs_drop(p->p_args); p->p_args = NULL; - - if (--p->p_procsig->ps_refcnt == 0) { - if (p->p_sigacts != &p->p_uarea->u_sigacts) - FREE(p->p_sigacts, M_SUBPROC); - FREE(p->p_procsig, M_SUBPROC); - p->p_procsig = NULL; - } + sigacts_free(p->p_sigacts); + p->p_sigacts = NULL; /* * do any thread-system specific cleanups ==== //depot/projects/smpng/sys/kern/kern_fork.c#60 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_fork.c 8.6 (Berkeley) 4/8/94 - * $FreeBSD: src/sys/kern/kern_fork.c,v 1.197 2003/05/01 21:16:38 jhb Exp $ + * $FreeBSD: src/sys/kern/kern_fork.c,v 1.198 2003/05/13 20:35:59 jhb Exp $ */ #include "opt_ktrace.h" @@ -214,7 +214,6 @@ struct kse *ke2; struct ksegrp *kg2; struct sigacts *newsigacts; - struct procsig *newprocsig; int error; /* Can't copy and clear */ @@ -412,15 +411,10 @@ /* * Malloc things while we don't hold any locks. */ - if (flags & RFSIGSHARE) { - MALLOC(newsigacts, struct sigacts *, - sizeof(struct sigacts), M_SUBPROC, M_WAITOK); - newprocsig = NULL; - } else { + if (flags & RFSIGSHARE) newsigacts = NULL; - MALLOC(newprocsig, struct procsig *, sizeof(struct procsig), - M_SUBPROC, M_WAITOK); - } + else >>> TRUNCATED FOR MAIL (1000 lines) <<<