summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2006-12-17 00:14:20 +0000
committerkmacy <kmacy@FreeBSD.org>2006-12-17 00:14:20 +0000
commitbb69932355b5c2ab822906df3468cba57cdab11e (patch)
treeaef96c665abd91864eccc18be5c9456a9e77c6f8
parentaebc61a22fd0290b0a5c49629fb9b20ad77270fc (diff)
downloadFreeBSD-src-bb69932355b5c2ab822906df3468cba57cdab11e.zip
FreeBSD-src-bb69932355b5c2ab822906df3468cba57cdab11e.tar.gz
Cleaner fix for handling declaration of loop variable under INVARIANTS
- in trying to avoid nested brackets and #ifdef INVARIANTS around i at the top, I broke booting for INVARIANTS all together :-( - the cleanest fix is to simply assign to sq twice if INVARIANTS is enabled - tested both with and without INVARIANTS :-/
-rw-r--r--sys/kern/subr_sleepqueue.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index 047cd2e..276d0aa 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -295,18 +295,18 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
* into the sleep queue already in use by this wait channel.
*/
if (sq == NULL) {
- sq = td->td_sleepqueue;
#ifdef INVARIANTS
- {
- int i;
+ int i;
- for (i = 0; i < NR_SLEEPQS; i++)
- KASSERT(TAILQ_EMPTY(&sq->sq_blocked[i]),
+ sq = td->td_sleepqueue;
+ for (i = 0; i < NR_SLEEPQS; i++)
+ KASSERT(TAILQ_EMPTY(&sq->sq_blocked[i]),
("thread's sleep queue %d is not empty", i));
- }
KASSERT(LIST_EMPTY(&sq->sq_free),
("thread's sleep queue has a non-empty free list"));
KASSERT(sq->sq_wchan == NULL, ("stale sq_wchan pointer"));
+ sq->sq_lock = lock;
+ sq->sq_type = flags & SLEEPQ_TYPE;
#endif
#ifdef SLEEPQUEUE_PROFILING
sc->sc_depth++;
@@ -316,12 +316,9 @@ sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags,
sleepq_max_depth = sc->sc_max_depth;
}
#endif
+ sq = td->td_sleepqueue;
LIST_INSERT_HEAD(&sc->sc_queues, sq, sq_hash);
sq->sq_wchan = wchan;
-#ifdef INVARIANTS
- sq->sq_lock = lock;
- sq->sq_type = flags & SLEEPQ_TYPE;
-#endif
} else {
MPASS(wchan == sq->sq_wchan);
MPASS(lock == sq->sq_lock);
OpenPOWER on IntegriCloud