summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2008-01-24 12:34:30 +0000
committerattilio <attilio@FreeBSD.org>2008-01-24 12:34:30 +0000
commit7213f4c32b94b60add6400f4213c1ca347bd609f (patch)
treec29223c268b9510bd1f4bee082ad1de97c817c24 /sys/kern/kern_lock.c
parent5671b69e5898140ead9c08fe7f302dde1d680c63 (diff)
downloadFreeBSD-src-7213f4c32b94b60add6400f4213c1ca347bd609f.zip
FreeBSD-src-7213f4c32b94b60add6400f4213c1ca347bd609f.tar.gz
Cleanup lockmgr interface and exported KPI:
- Remove the "thread" argument from the lockmgr() function as it is always curthread now - Axe lockcount() function as it is no longer used - Axe LOCKMGR_ASSERT() as it is bogus really and no currently used. Hopefully this will be soonly replaced by something suitable for it. - Remove the prototype for dumplockinfo() as the function is no longer present Addictionally: - Introduce a KASSERT() in lockstatus() in order to let it accept only curthread or NULL as they should only be passed - Do a little bit of style(9) cleanup on lockmgr.h KPI results heavilly broken by this change, so manpages and FreeBSD_version will be modified accordingly by further commits. Tested by: matteo
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 5ce5ffd..a13dcc7 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
OpenPOWER on IntegriCloud