summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_switch.c
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-02-24 14:06:36 +0000
committerjake <jake@FreeBSD.org>2001-02-24 14:06:36 +0000
commitd42fc47e4a2b6f0dc0c36610ecb37edafb000cd0 (patch)
treefe554e3c77185c2c5ac6bf2f857717e465816555 /sys/kern/kern_switch.c
parentc33a989ee70faf329c549bc692f799e1631875a3 (diff)
downloadFreeBSD-src-d42fc47e4a2b6f0dc0c36610ecb37edafb000cd0.zip
FreeBSD-src-d42fc47e4a2b6f0dc0c36610ecb37edafb000cd0.tar.gz
- 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.
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 8374048..bfe0e7f 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]);
}
OpenPOWER on IntegriCloud