diff options
author | jeff <jeff@FreeBSD.org> | 2003-02-17 09:58:11 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-02-17 09:58:11 +0000 |
commit | 5c29a640b86af6a1bd38d6186b82cba5e9c21065 (patch) | |
tree | 4c53a750b6910eb1a28edeff1a48bdd7ef932736 /sys/kern/kern_thread.c | |
parent | af55753a063a04a847a53c2946cd5fbf413a1e0f (diff) | |
download | FreeBSD-src-5c29a640b86af6a1bd38d6186b82cba5e9c21065.zip FreeBSD-src-5c29a640b86af6a1bd38d6186b82cba5e9c21065.tar.gz |
- Add a new function, thread_signal_add(), that is called from postsig to
add a signal to a mailbox's pending set.
- Add a new function, thread_signal_upcall(), this causes the current thread
to upcall so that we can deliver pending signals.
Reviewed by: mini
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r-- | sys/kern/kern_thread.c | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 7ec5b57..183b607 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1425,44 +1425,50 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku) return (td2); /* bogus.. should be a void function */ } -/* - * Schedule an upcall to notify a KSE process recieved signals. - * - * XXX - Modifying a sigset_t like this is totally bogus. - */ -struct thread * -signal_upcall(struct proc *p, int sig) +void +thread_signal_add(struct thread *td, int sig) { -#if 0 - struct thread *td, *td2; - struct kse *ke; + struct kse_upcall *ku; + struct proc *p; sigset_t ss; int error; -#endif - PROC_LOCK_ASSERT(p, MA_OWNED); -return (NULL); -#if 0 - td = FIRST_THREAD_IN_PROC(p); - ke = td->td_kse; + PROC_LOCK_ASSERT(td->td_proc, MA_OWNED); + td = curthread; + ku = td->td_upcall; + p = td->td_proc; + PROC_UNLOCK(p); - error = copyin(&ke->ke_mailbox->km_sigscaught, &ss, sizeof(sigset_t)); - PROC_LOCK(p); + error = copyin(&ku->ku_mailbox->km_sigscaught, &ss, sizeof(sigset_t)); if (error) - return (NULL); + goto error; + SIGADDSET(ss, sig); - PROC_UNLOCK(p); - error = copyout(&ss, &ke->ke_mailbox->km_sigscaught, sizeof(sigset_t)); - PROC_LOCK(p); + + error = copyout(&ss, &ku->ku_mailbox->km_sigscaught, sizeof(sigset_t)); if (error) - return (NULL); - if (td->td_standin == NULL) - thread_alloc_spare(td, NULL); + goto error; + + PROC_LOCK(p); + return; +error: + PROC_LOCK(p); + sigexit(td, SIGILL); +} + + +/* + * Schedule an upcall to notify a KSE process recieved signals. + * + */ +void +thread_signal_upcall(struct thread *td) +{ mtx_lock_spin(&sched_lock); - td2 = thread_schedule_upcall(td, ke); /* Bogus JRE */ + td->td_flags |= TDF_UPCALLING; mtx_unlock_spin(&sched_lock); - return (td2); -#endif + + return; } /* |