summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-05-13 20:36:02 +0000
committerjhb <jhb@FreeBSD.org>2003-05-13 20:36:02 +0000
commit89a4eb17deddba4ba8bfb0cf7c6801a608731f8c (patch)
tree0e2ba79e40f08e96bb98756b67576ff96caccfbc /sys/pc98
parent3b9288c6f4df2bfdc2a41de3ae161246c310e064 (diff)
downloadFreeBSD-src-89a4eb17deddba4ba8bfb0cf7c6801a608731f8c.zip
FreeBSD-src-89a4eb17deddba4ba8bfb0cf7c6801a608731f8c.tar.gz
- Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson)
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/i386/machdep.c21
-rw-r--r--sys/pc98/pc98/machdep.c21
2 files changed, 24 insertions, 18 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index b9013a2..4797ae1 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -315,6 +315,7 @@ osendsig(catcher, sig, mask, code)
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);
@@ -328,7 +329,6 @@ osendsig(catcher, sig, mask, code)
#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)
@@ -337,8 +337,7 @@ osendsig(catcher, sig, mask, code)
/* 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;
@@ -350,6 +349,7 @@ osendsig(catcher, sig, mask, code)
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. */
@@ -422,6 +422,7 @@ osendsig(catcher, sig, mask, code)
load_gs(_udatasel);
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_43 */
@@ -444,6 +445,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
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);
@@ -467,7 +469,6 @@ freebsd4_sendsig(catcher, sig, mask, code)
#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)
@@ -476,8 +477,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
/* 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;
@@ -492,6 +492,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -543,6 +544,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_FREEBSD4 */
@@ -565,6 +567,7 @@ sendsig(catcher, sig, mask, code)
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);
@@ -605,7 +608,6 @@ sendsig(catcher, sig, mask, code)
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)
@@ -614,8 +616,7 @@ sendsig(catcher, sig, mask, code)
/* 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;
@@ -630,6 +631,7 @@ sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -681,6 +683,7 @@ sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
/*
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index b9013a2..4797ae1 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -315,6 +315,7 @@ osendsig(catcher, sig, mask, code)
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);
@@ -328,7 +329,6 @@ osendsig(catcher, sig, mask, code)
#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)
@@ -337,8 +337,7 @@ osendsig(catcher, sig, mask, code)
/* 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;
@@ -350,6 +349,7 @@ osendsig(catcher, sig, mask, code)
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. */
@@ -422,6 +422,7 @@ osendsig(catcher, sig, mask, code)
load_gs(_udatasel);
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_43 */
@@ -444,6 +445,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
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);
@@ -467,7 +469,6 @@ freebsd4_sendsig(catcher, sig, mask, code)
#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)
@@ -476,8 +477,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
/* 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;
@@ -492,6 +492,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -543,6 +544,7 @@ freebsd4_sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
#endif /* COMPAT_FREEBSD4 */
@@ -565,6 +567,7 @@ sendsig(catcher, sig, mask, code)
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);
@@ -605,7 +608,6 @@ sendsig(catcher, sig, mask, code)
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)
@@ -614,8 +616,7 @@ sendsig(catcher, sig, mask, code)
/* 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;
@@ -630,6 +631,7 @@ sendsig(catcher, sig, mask, code)
sf.sf_addr = regs->tf_err;
sf.sf_ahu.sf_handler = catcher;
}
+ mtx_unlock(&psp->ps_mtx);
PROC_UNLOCK(p);
/*
@@ -681,6 +683,7 @@ sendsig(catcher, sig, mask, code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
/*
OpenPOWER on IntegriCloud