diff options
author | jhb <jhb@FreeBSD.org> | 2010-05-21 17:15:56 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2010-05-21 17:15:56 +0000 |
commit | ce208e1f416b3cd9a575871ae3bf80ee8d52d960 (patch) | |
tree | c4ee8e41ff246b68f38493b812a98392ceaf6878 /sys/kern | |
parent | b7fc8e97f173c690a532a6b0d6cf03822538e8ba (diff) | |
download | FreeBSD-src-ce208e1f416b3cd9a575871ae3bf80ee8d52d960.zip FreeBSD-src-ce208e1f416b3cd9a575871ae3bf80ee8d52d960.tar.gz |
Assert that the thread passed to sched_bind() and sched_unbind() is
curthread as those routines are only supported for curthread currently.
MFC after: 1 month
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/sched_4bsd.c | 6 | ||||
-rw-r--r-- | sys/kern/sched_ule.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index cf215f5..b4098c8 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1462,9 +1462,8 @@ sched_bind(struct thread *td, int cpu) { struct td_sched *ts; - THREAD_LOCK_ASSERT(td, MA_OWNED); - KASSERT(TD_IS_RUNNING(td), - ("sched_bind: cannot bind non-running thread")); + THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED); + KASSERT(td == curthread, ("sched_bind: can only bind curthread")); ts = td->td_sched; @@ -1482,6 +1481,7 @@ void sched_unbind(struct thread* td) { THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT(td == curthread, ("sched_unbind: can only bind curthread")); td->td_flags &= ~TDF_BOUND; } diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index f5e5ee0..274b2b1 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -2427,6 +2427,7 @@ sched_bind(struct thread *td, int cpu) struct td_sched *ts; THREAD_LOCK_ASSERT(td, MA_OWNED|MA_NOTRECURSED); + KASSERT(td == curthread, ("sched_bind: can only bind curthread")); ts = td->td_sched; if (ts->ts_flags & TSF_BOUND) sched_unbind(td); @@ -2448,6 +2449,7 @@ sched_unbind(struct thread *td) struct td_sched *ts; THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT(td == curthread, ("sched_unbind: can only bind curthread")); ts = td->td_sched; if ((ts->ts_flags & TSF_BOUND) == 0) return; |