summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_sysvec.c
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/i386/linux/linux_sysvec.c
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/i386/linux/linux_sysvec.c')
-rw-r--r--sys/i386/linux/linux_sysvec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c
index 27105bc..706c944 100644
--- a/sys/i386/linux/linux_sysvec.c
+++ b/sys/i386/linux/linux_sysvec.c
@@ -273,11 +273,14 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
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);
@@ -290,11 +293,12 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* 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.
@@ -383,6 +387,7 @@ linux_rt_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
@@ -401,13 +406,16 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
{
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;
@@ -426,11 +434,12 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
* 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);
/*
@@ -494,6 +503,7 @@ linux_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
regs->tf_fs = _udatasel;
regs->tf_ss = _udatasel;
PROC_LOCK(p);
+ mtx_lock(&psp->ps_mtx);
}
/*
OpenPOWER on IntegriCloud