diff options
| author | Julian Elischer <julian@FreeBSD.org> | 2002-10-20 21:08:47 +0000 |
|---|---|---|
| committer | Julian Elischer <julian@FreeBSD.org> | 2002-10-20 21:08:47 +0000 |
| commit | 2f030624b1868c3fddef8433322e67b0e3e69700 (patch) | |
| tree | a1d7903aa308246f2d43b3f073e086fea0c3bdf7 /sys/kern/kern_proc.c | |
| parent | b8c9bc1a22daa97ef9813e198b8a957a169948cd (diff) | |
Notes
Diffstat (limited to 'sys/kern/kern_proc.c')
| -rw-r--r-- | sys/kern/kern_proc.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 66b3c790b9f9..e38a6fb98ee6 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -329,8 +329,48 @@ kse_release(struct thread *td, struct kse_release_args *uap) int kse_wakeup(struct thread *td, struct kse_wakeup_args *uap) { + struct proc *p; + struct kse *ke, *ke2; + struct ksegrp *kg; - return(ENOSYS); + p = td->td_proc; + /* KSE-enabled processes only, please. */ + if (!(p->p_flag & P_KSES)) + return EINVAL; + if (td->td_standin == NULL) + td->td_standin = thread_alloc(); + ke = NULL; + mtx_lock_spin(&sched_lock); + if (uap->mbx) { + FOREACH_KSEGRP_IN_PROC(p, kg) { + FOREACH_KSE_IN_GROUP(kg, ke2) { + if (ke2->ke_mailbox != uap->mbx) + continue; + if (ke2->ke_flags & KEF_IDLEKSE) { + ke = ke2; + goto found; + } else { + mtx_unlock_spin(&sched_lock); + td->td_retval[0] = 0; + td->td_retval[1] = 0; + return 0; + } + } + } + } else { + kg = td->td_ksegrp; + ke = TAILQ_FIRST(&kg->kg_iq); + } + if (ke == NULL) { + mtx_unlock_spin(&sched_lock); + return ESRCH; + } +found: + thread_schedule_upcall(td, ke); + mtx_unlock_spin(&sched_lock); + td->td_retval[0] = 0; + td->td_retval[1] = 0; + return 0; } /* |
