summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sig.c
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2005-04-19 08:11:28 +0000
committerDavid Xu <davidxu@FreeBSD.org>2005-04-19 08:11:28 +0000
commit407948a530b8c08803de44536578ac593dea53c4 (patch)
treed99227ec181130a6116e223dfb758d2137d8b9b3 /sys/kern/kern_sig.c
parent95992d56f5a1c06cc0cbb72b8949dff5ee8626d6 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r--sys/kern/kern_sig.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 71427d7f2ce1..1cd5ca70bad8 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -85,7 +85,6 @@ static char *expand_name(const char *, uid_t, pid_t);
static int killpg1(struct thread *td, int sig, int pgid, int all);
static int issignal(struct thread *p);
static int sigprop(int sig);
-static void stop(struct proc *);
static void tdsigwakeup(struct thread *td, int sig, sig_t action);
static int filt_sigattach(struct knote *kn);
static void filt_sigdetach(struct knote *kn);
@@ -2250,21 +2249,6 @@ issignal(td)
}
/*
- * Put the argument process into the stopped state and notify the parent
- * via wakeup. Signals are handled elsewhere. The process must not be
- * on the run queue. Must be called with the proc p locked.
- */
-static void
-stop(struct proc *p)
-{
-
- PROC_LOCK_ASSERT(p, MA_OWNED);
- p->p_flag |= P_STOPPED_SIG;
- p->p_flag &= ~P_WAITED;
- wakeup(p->p_pptr);
-}
-
-/*
* MPSAFE
*/
void
@@ -2281,8 +2265,16 @@ thread_stopped(struct proc *p)
n++;
if ((p->p_flag & P_STOPPED_SIG) && (n == p->p_numthreads)) {
mtx_unlock_spin(&sched_lock);
- stop(p);
+ p->p_flag &= ~P_WAITED;
PROC_LOCK(p->p_pptr);
+ /*
+ * Wake up parent sleeping in kern_wait(), also send
+ * SIGCHLD to parent, but SIGCHLD does not guarantee
+ * that parent will awake, because parent may masked
+ * the signal.
+ */
+ p->p_pptr->p_flag |= P_STATCHILD;
+ wakeup(p->p_pptr);
ps = p->p_pptr->p_sigacts;
mtx_lock(&ps->ps_mtx);
if ((ps->ps_flag & PS_NOCLDSTOP) == 0) {