summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
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