summaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2008-01-24 12:34:30 +0000
committerAttilio Rao <attilio@FreeBSD.org>2008-01-24 12:34:30 +0000
commit0e9eb108f034c1ec44b2eb718685a854604ced4c (patch)
treec29223c268b9510bd1f4bee082ad1de97c817c24 /sys/kern/kern_lock.c
parentdb8665e64954e22ee61f796b7a2c50f49a0fd6b6 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 5ce5ffdc38ab..a13dcc769c8f 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -189,23 +189,18 @@ acquire(struct lock **lkpp, int extflags, int wanted, int *contested, uint64_t *
* accepted shared locks and shared-to-exclusive upgrades to go away.
*/
int
-_lockmgr(struct lock *lkp, u_int flags, struct mtx *interlkp,
- struct thread *td, char *file, int line)
+_lockmgr(struct lock *lkp, u_int flags, struct mtx *interlkp, char *file,
+ int line)
{
+ struct thread *td;
int error;
int extflags, lockflags;
int contested = 0;
uint64_t waitstart = 0;
- /*
- * Lock owner can only be curthread in order to have a deadlock
- * free implementation of the primitive.
- */
- KASSERT(td == curthread,
- ("lockmgr: owner thread (%p) cannot differ from curthread", td));
-
error = 0;
+ td = curthread;
if ((flags & LK_INTERNAL) == 0)
mtx_lock(lkp->lk_interlock);
@@ -576,6 +571,9 @@ lockstatus(lkp, td)
int lock_type = 0;
int interlocked;
+ KASSERT(td == NULL || td == curthread,
+ ("%s: thread passed argument (%p) is not valid", __func__, td));
+
if (!kdb_active) {
interlocked = 1;
mtx_lock(lkp->lk_interlock);
@@ -594,21 +592,6 @@ lockstatus(lkp, td)
}
/*
- * Determine the number of holders of a lock.
- */
-int
-lockcount(lkp)
- struct lock *lkp;
-{
- int count;
-
- mtx_lock(lkp->lk_interlock);
- count = lkp->lk_exclusivecount + lkp->lk_sharecount;
- mtx_unlock(lkp->lk_interlock);
- return (count);
-}
-
-/*
* Determine the number of waiters on a lock.
*/
int