summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-11-09 06:52:16 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-11-09 06:52:16 +0000
commit8f2125daa0aadde54c4d9fc46d335caefefdbc0d (patch)
treea4d59979ed4b0de74afd5df43477f312f7ba32b0 /sys
parentebeca2ee0946f500425172561e4df741829df085 (diff)
Add KASSERT()s to tsleep() and msleep() to verify that bogus flags
aren't being passed to them. Fix UVM_WAIT() to not pass PNORELOCK to tsleep(), as that flag only does something with msleep(). ok beck@ dlg@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c6
-rw-r--r--sys/uvm/uvm.h6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index c36367772a9..9edfc5866a4 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.108 2013/09/14 01:35:01 guenther Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.109 2013/11/09 06:52:15 guenther Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -107,6 +107,8 @@ tsleep(const volatile void *ident, int priority, const char *wmesg, int timo)
struct sleep_state sls;
int error, error1;
+ KASSERT((priority & ~(PRIMASK | PCATCH)) == 0);
+
if (cold || panicstr) {
int s;
/*
@@ -147,6 +149,8 @@ msleep(const volatile void *ident, struct mutex *mtx, int priority,
struct sleep_state sls;
int error, error1, spl;
+ KASSERT((priority & ~(PRIMASK | PCATCH | PNORELOCK)) == 0);
+
sleep_setup(&sls, ident, priority, wmesg);
sleep_setup_timeout(&sls, timo);
sleep_setup_signal(&sls, priority);
diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h
index c51d8cabab0..f68d5daa498 100644
--- a/sys/uvm/uvm.h
+++ b/sys/uvm/uvm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm.h,v 1.51 2013/05/30 16:39:26 tedu Exp $ */
+/* $OpenBSD: uvm.h,v 1.52 2013/11/09 06:52:15 guenther Exp $ */
/* $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $ */
/*
@@ -133,9 +133,9 @@ extern struct uvm uvm;
* UVM_WAIT: wait... wrapper around the tsleep() function.
*/
-#define UVM_WAIT(event, intr, msg, timo) \
+#define UVM_WAIT(event, intr, msg, timo) \
do { \
- tsleep(event, PVM|PNORELOCK|(intr ? PCATCH : 0), msg, timo); \
+ tsleep(event, PVM|(intr ? PCATCH : 0), msg, timo); \
} while (0)
/*