summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-05-06 16:37:55 +0000
committertedu <tedu@openbsd.org>2013-05-06 16:37:55 +0000
commitf6126badfa6a39d93e56856c718baad6b0e50cd3 (patch)
treec252c6335c3d3a895eb02b3bbaf70a12f4f50f7b /sys
parentactually show list of mismatched for loops when a fatal error occurs. (diff)
downloadwireguard-openbsd-f6126badfa6a39d93e56856c718baad6b0e50cd3.tar.xz
wireguard-openbsd-f6126badfa6a39d93e56856c718baad6b0e50cd3.zip
restore original gangster lockstatus return values for compat
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_lock.c12
-rw-r--r--sys/kern/kern_rwlock.c8
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 77a883c1c8f..c87cb9a3a51 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_lock.c,v 1.41 2013/05/01 17:18:55 tedu Exp $ */
+/* $OpenBSD: kern_lock.c,v 1.42 2013/05/06 16:37:55 tedu Exp $ */
/*
* Copyright (c) 1995
@@ -61,7 +61,15 @@ lockinit(struct lock *lkp, int prio, char *wmesg, int timo, int flags)
int
lockstatus(struct lock *lkp)
{
- return (rrw_status(&lkp->lk_lck));
+ switch (rrw_status(&lkp->lk_lck)) {
+ case RW_WRITE:
+ return (LK_EXCLUSIVE);
+ case RW_READ:
+ return (LK_SHARED);
+ case 0:
+ default:
+ return (0);
+ }
}
int
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index 596f302308b..27ad632e806 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_rwlock.c,v 1.19 2013/05/01 17:18:55 tedu Exp $ */
+/* $OpenBSD: kern_rwlock.c,v 1.20 2013/05/06 16:37:55 tedu Exp $ */
/*
* Copyright (c) 2002, 2003 Artur Grabowski <art@openbsd.org>
@@ -256,7 +256,11 @@ rw_exit(struct rwlock *rwl)
int
rw_status(struct rwlock *rwl)
{
- return (rwl->rwl_owner != 0L);
+ if (rwl->rwl_owner & RWLOCK_WRLOCK)
+ return RW_WRITE;
+ if (rwl->rwl_owner)
+ return RW_READ;
+ return (0);
}
#ifdef DIAGNOSTIC