diff options
author | julian <julian@FreeBSD.org> | 2002-08-21 20:03:55 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2002-08-21 20:03:55 +0000 |
commit | c99effb6f5993f9742a6d14c8ae3ff8e284d7aac (patch) | |
tree | 2c17d7ffeaacbfc2ab3d4eceb44966289ad75321 /sys/kern/kern_sig.c | |
parent | ee1c2cc721087a0b3e7657c05643ca6701aa2bfa (diff) | |
download | FreeBSD-src-c99effb6f5993f9742a6d14c8ae3ff8e284d7aac.zip FreeBSD-src-c99effb6f5993f9742a6d14c8ae3ff8e284d7aac.tar.gz |
Revert some suspension/sleep/signal code from KSE-III
We need to rethink a bit of this and it doesn't matter if
we break the KSE test program for now as long
as non-KSE programs act as expected.
Submitted by: David Xu <bsddiy@yahoo.com>
(this guy's just asking to get hit with a commit bit..)
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 70 |
1 files changed, 27 insertions, 43 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 776764a..c20ccd2 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1416,46 +1416,14 @@ psignal(p, sig) SIGDELSET(p->p_siglist, sig); goto out; } - /* - * When a sleeping process receives a stop - * signal, process immediately if possible. - * All other (caught or default) signals - * cause the process to run. - */ if (prop & SA_STOP) { - int should_signal = 1; - if (action != SIG_DFL) - goto runfast; - - /* - * If a child holding parent blocked, - * stopping could cause deadlock. - */ - if (p->p_flag & P_PPWAIT) - goto out; - SIGDELSET(p->p_siglist, sig); - p->p_xstat = sig; - PROC_LOCK(p->p_pptr); /* XXX un-needed? */ -#if 0 - FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_state == TDS_RUNNING) { - /* - * all other states must be in - * the kernel - */ - should_signal = 0; - break; - } - } -/* don't enable until the equivalent code is in thread_suspend_check() */ -#endif - if (!(p->p_pptr->p_procsig->ps_flag & PS_NOCLDSTOP) && - should_signal) - psignal(p->p_pptr, SIGCHLD); - PROC_UNLOCK(p->p_pptr); - stop(p); + mtx_lock_spin(&sched_lock); + FOREACH_THREAD_IN_PROC(p, td) + tdsignal(td, sig, action); + mtx_unlock_spin(&sched_lock); goto out; - } else + } + else goto runfast; /* NOTREACHED */ } else { @@ -1683,18 +1651,34 @@ issignal(td) * process group, ignore tty stop signals. */ if (prop & SA_STOP) { + WITNESS_SLEEP(1, &p->p_mtx.mtx_object); if (p->p_flag & P_TRACED || (p->p_pgrp->pg_jobc == 0 && prop & SA_TTYSTOP)) break; /* == ignore */ p->p_xstat = sig; - PROC_LOCK(p->p_pptr); - if ((p->p_pptr->p_procsig->ps_flag & - PS_NOCLDSTOP) == 0) { - psignal(p->p_pptr, SIGCHLD); + mtx_lock_spin(&sched_lock); + if (p->p_suspcount+1 == p->p_numthreads) { + mtx_unlock_spin(&sched_lock); + PROC_LOCK(p->p_pptr); + if ((p->p_pptr->p_procsig->ps_flag & + PS_NOCLDSTOP) == 0) { + psignal(p->p_pptr, SIGCHLD); + } + PROC_UNLOCK(p->p_pptr); } - PROC_UNLOCK(p->p_pptr); stop(p); + mtx_lock_spin(&sched_lock); + p->p_suspcount++; + td->td_state = TDS_SUSPENDED; + TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq); + PROC_UNLOCK(p); + DROP_GIANT(); + p->p_stats->p_ru.ru_nivcsw++; + mi_switch(); + mtx_unlock_spin(&sched_lock); + PICKUP_GIANT(); + PROC_LOCK(p); break; } else if (prop & SA_IGNORE) { |