summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-09 13:32:00 +0000
committerguenther <guenther@openbsd.org>2014-07-09 13:32:00 +0000
commita5d9e1e8d1a8914f4ac7f85c1ec4194f157bfb81 (patch)
treeb187afe08c03f0f72cedd307a878bd1c55d5c608 /sys/kern/kern_lock.c
parentSimplify error path of DH_check_pub_key() (diff)
downloadwireguard-openbsd-a5d9e1e8d1a8914f4ac7f85c1ec4194f157bfb81.tar.xz
wireguard-openbsd-a5d9e1e8d1a8914f4ac7f85c1ec4194f157bfb81.zip
Teach rw_status() and rrw_status() to return LK_EXCLOTHER if it's write
locked by a different thread. Teach lockstatus() to return LK_EXCLUSIVE if an exclusive lock is held by some other thread. ok beck@ tedu@
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index cef4c7c7664..946fd17e3b3 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.43 2014/01/21 01:48:44 tedu Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.44 2014/07/09 13:32:00 guenther Exp $ */
/*
* Copyright (c) 1995
@@ -64,6 +64,8 @@ lockstatus(struct lock *lkp)
switch (rrw_status(&lkp->lk_lck)) {
case RW_WRITE:
return (LK_EXCLUSIVE);
+ case RW_WRITE_OTHER:
+ return (LK_EXCLOTHER);
case RW_READ:
return (LK_SHARED);
case 0: