diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2013-05-06 16:37:56 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2013-05-06 16:37:56 +0000 |
commit | 88e484656a89efe0d344dc4106f1902a187ecb60 (patch) | |
tree | 219e6132e6c4bd3ad95899511fa13e5fba0fbab6 /sys/kern | |
parent | c823a490466715a72e583dbf5c90783d53211829 (diff) |
restore original gangster lockstatus return values for compat
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lock.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_rwlock.c | 8 |
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 |