summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-03-17 18:26:51 +0000
committerart <art@openbsd.org>2002-03-17 18:26:51 +0000
commit24ea32be9d41ad0d078842ae5590907634af9fc8 (patch)
tree5f13a02c9fb42152d1da5bf6ade3bf93bd27e09e
parentAdd references to FILES and SEE ALSO sections. From David Krause. (diff)
downloadwireguard-openbsd-24ea32be9d41ad0d078842ae5590907634af9fc8.tar.xz
wireguard-openbsd-24ea32be9d41ad0d078842ae5590907634af9fc8.zip
Add a DIAGNOSTIC check for when both LK_CANRECURSE and
LK_RECURSEFAIL are set.
-rw-r--r--sys/kern/kern_lock.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index e21182ba649..b35d8f25c23 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.12 2002/03/14 01:27:04 millert Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.13 2002/03/17 18:26:51 art Exp $ */
/*
* Copyright (c) 1995
@@ -205,6 +205,13 @@ lockmgr(lkp, flags, interlkp, p)
if ((flags & LK_REENABLE) == 0)
lkp->lk_flags |= LK_DRAINED;
}
+
+ /*
+ * Check if the caller is asking us to be schizophrenic.
+ */
+ if ((lkp->lk_flags & (LK_CANRECURSE|LK_RECURSEFAIL)) ==
+ (LK_CANRECURSE|LK_RECURSEFAIL))
+ panic("lockmgr: make up your mind");
#endif /* DIAGNOSTIC */
switch (flags & LK_TYPE_MASK) {