diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-03-11 02:59:50 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-03-11 02:59:50 +0000 |
commit | b47a4be33ec42eb423369b77f6da7b572b07edb4 (patch) | |
tree | c28b73dc40a4a07a188972e792db22e3ade7eda9 /sys | |
parent | 178970c2cc97ea4ea53737b4eace117920af55f9 (diff) | |
download | FreeBSD-src-b47a4be33ec42eb423369b77f6da7b572b07edb4.zip FreeBSD-src-b47a4be33ec42eb423369b77f6da7b572b07edb4.tar.gz |
Fix signal delivering bug for threaded process.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_kse.c | 10 | ||||
-rw-r--r-- | sys/kern/kern_thread.c | 10 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 10 |
3 files changed, 16 insertions, 14 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 2c8e65f..2356372 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1601,14 +1601,12 @@ thread_userret(struct thread *td, struct trapframe *frame) mtx_lock_spin(&sched_lock); td->td_flags &= ~TDF_CAN_UNBIND; mtx_unlock_spin(&sched_lock); - if ((kg->kg_completed == NULL) && + if ((p->p_flag & PS_NEEDSIGCHK) == 0 && + (kg->kg_completed == NULL) && (td->td_upcall->ku_flags & KUF_DOUPCALL) == 0) { thread_update_usr_ticks(td, 0); - if (!(kg->kg_completed || - (td->td_upcall->ku_flags & KUF_DOUPCALL))) { - td->td_mailbox = NULL; - return (0); - } + td->td_mailbox = 0; + return (0); } error = thread_export_context(td); if (error) { diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 2c8e65f..2356372 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1601,14 +1601,12 @@ thread_userret(struct thread *td, struct trapframe *frame) mtx_lock_spin(&sched_lock); td->td_flags &= ~TDF_CAN_UNBIND; mtx_unlock_spin(&sched_lock); - if ((kg->kg_completed == NULL) && + if ((p->p_flag & PS_NEEDSIGCHK) == 0 && + (kg->kg_completed == NULL) && (td->td_upcall->ku_flags & KUF_DOUPCALL) == 0) { thread_update_usr_ticks(td, 0); - if (!(kg->kg_completed || - (td->td_upcall->ku_flags & KUF_DOUPCALL))) { - td->td_mailbox = NULL; - return (0); - } + td->td_mailbox = 0; + return (0); } error = thread_export_context(td); if (error) { diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 9eb4aed..fe5f1e4 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -253,8 +253,14 @@ ast(struct trapframe *framep) sigs++; } PROC_UNLOCK(p); - if (p->p_flag & P_THREADED && sigs) - thread_signal_upcall(td); + if (p->p_flag & P_THREADED && sigs) { + struct kse_upcall *ku = td->td_upcall; + if ((void *)TRAPF_PC(framep) != ku->ku_func) { + mtx_lock_spin(&sched_lock); + ku->ku_flags |= KUF_DOUPCALL; + mtx_unlock_spin(&sched_lock); + } + } } userret(td, framep, sticks); |