summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-12-11 16:13:02 +0000
committereivind <eivind@FreeBSD.org>1999-12-11 16:13:02 +0000
commit287836faea1ff2f002f4c9ea357e87cb7f2b4cd6 (patch)
tree9524fb381c1cbe8aed4ee0af7b1a693057985617 /sys/kern/kern_lock.c
parentff090abf5121f6bf2199248b70a4896d25f49550 (diff)
downloadFreeBSD-src-287836faea1ff2f002f4c9ea357e87cb7f2b4cd6.zip
FreeBSD-src-287836faea1ff2f002f4c9ea357e87cb7f2b4cd6.tar.gz
Lock reporting and assertion changes.
* lockstatus() and VOP_ISLOCKED() gets a new process argument and a new return value: LK_EXCLOTHER, when the lock is held exclusively by another process. * The ASSERT_VOP_(UN)LOCKED family is extended to use what this gives them * Extend the vnode_if.src format to allow more exact specification than locked/unlocked. This commit should not do any semantic changes unless you are using DEBUG_VFS_LOCKS. Discussed with: grog, mch, peter, phk Reviewed by: peter
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index d80561d..b47ca55 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -511,15 +511,19 @@ lockinit(lkp, prio, wmesg, timo, flags)
* Determine the status of a lock.
*/
int
-lockstatus(lkp)
+lockstatus(lkp, p)
struct lock *lkp;
+ struct proc *p;
{
int lock_type = 0;
simple_lock(&lkp->lk_interlock);
- if (lkp->lk_exclusivecount != 0)
- lock_type = LK_EXCLUSIVE;
- else if (lkp->lk_sharecount != 0)
+ if (lkp->lk_exclusivecount != 0) {
+ if (p == NULL || lkp->lk_lockholder == p->p_pid)
+ lock_type = LK_EXCLUSIVE;
+ else
+ lock_type = LK_EXCLOTHER;
+ } else if (lkp->lk_sharecount != 0)
lock_type = LK_SHARED;
simple_unlock(&lkp->lk_interlock);
return (lock_type);
OpenPOWER on IntegriCloud