diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 697b327..36fb8e5 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -375,6 +375,7 @@ hardclock(systimer_t info, int in_ipi __unused, struct intrframe *frame) { sysclock_t cputicks; struct proc *p; + struct lwp *lwp; struct globaldata *gd = mycpu; /* @@ -557,15 +558,21 @@ hardclock(systimer_t info, int in_ipi __unused, struct intrframe *frame) * to be non-blocking. */ if ((p = curproc) != NULL && lwkt_trytoken(&p->p_token)) { + lwp = find_lwp_for_signal(p, SIGVTALRM); crit_enter_hard(); if (frame && CLKF_USERMODE(frame) && timevalisset(&p->p_timer[ITIMER_VIRTUAL].it_value) && itimerdecr(&p->p_timer[ITIMER_VIRTUAL], ustick) == 0) - ksignal(p, SIGVTALRM); + lwpsignal(p, lwp, SIGVTALRM); + crit_exit_hard(); + lwkt_reltoken(&lwp->lwp_token); + lwp = find_lwp_for_signal(p, SIGPROF); + crit_enter_hard(); if (timevalisset(&p->p_timer[ITIMER_PROF].it_value) && itimerdecr(&p->p_timer[ITIMER_PROF], ustick) == 0) - ksignal(p, SIGPROF); + lwpsignal(p, lwp, SIGPROF); crit_exit_hard(); + lwkt_reltoken(&lwp->lwp_token); lwkt_reltoken(&p->p_token); } setdelayed(); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 9fc1c3c..2680b8a 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -958,7 +958,7 @@ trapsignal(struct lwp *lp, int sig, u_long code) * Returns a lp or NULL. If non-NULL the lp is held and its token is * acquired. */ -static struct lwp * +struct lwp * find_lwp_for_signal(struct proc *p, int sig) { struct lwp *lp; diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index 67889a4..e1602c6 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -202,7 +202,7 @@ void ksignal (struct proc *p, int sig); void lwpsignal (struct proc *p, struct lwp *lp, int sig); void siginit (struct proc *p); void trapsignal (struct lwp *p, int sig, u_long code); - +struct lwp *find_lwp_for_signal(struct proc *p, int sig); /* * Machine-dependent functions: */