aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_switch.c
diff options
context:
space:
mode:
authorJake Burkholder <jake@FreeBSD.org>2001-02-24 14:06:36 +0000
committerJake Burkholder <jake@FreeBSD.org>2001-02-24 14:06:36 +0000
commitf32ded2fb5f737f8e86e7bd813d23bd14e2a00a1 (patch)
treeb06f9f6f309b81b6a01fddd531c44611e34cead3 /sys/kern/kern_switch.c
parent41b55591ceaf7f836aff8c7acc65d79b221c8885 (diff)
downloadsrc-f32ded2fb5f737f8e86e7bd813d23bd14e2a00a1.tar.gz
src-f32ded2fb5f737f8e86e7bd813d23bd14e2a00a1.zip
- Assert that the proc to return is not NULL in runq_choose the
same as runq_remove. - bzero the whole struct runq in runq_init just in case its not statically allocated.
Notes
Notes: svn path=/head/; revision=72977
Diffstat (limited to 'sys/kern/kern_switch.c')
-rw-r--r--sys/kern/kern_switch.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c
index 8374048b1d07..bfe0e7f0f9dd 100644
--- a/sys/kern/kern_switch.c
+++ b/sys/kern/kern_switch.c
@@ -189,6 +189,7 @@ runq_choose(struct runq *rq)
if ((pri = runq_findbit(rq)) != -1) {
rqh = &rq->rq_queues[pri];
p = TAILQ_FIRST(rqh);
+ KASSERT(p != NULL, ("runq_choose: no proc on busy queue"));
CTR3(KTR_RUNQ, "runq_choose: pri=%d p=%p rqh=%p", pri, p, rqh);
TAILQ_REMOVE(rqh, p, p_procq);
if (TAILQ_EMPTY(rqh)) {
@@ -210,6 +211,7 @@ runq_init(struct runq *rq)
{
int i;
+ bzero(rq, sizeof *rq);
for (i = 0; i < RQ_NQS; i++)
TAILQ_INIT(&rq->rq_queues[i]);
}