summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-01-20 14:49:12 +0000
committereivind <eivind@FreeBSD.org>1999-01-20 14:49:12 +0000
commit836035a4edf2d12174893117e0db29e309203a8b (patch)
treeb49b8271eedf41e5c0a341956ab5c43489f98b71 /sys/kern/kern_lock.c
parentaf1ac09a53e9b9f7d330522b7109c3ae65dbba61 (diff)
downloadFreeBSD-src-836035a4edf2d12174893117e0db29e309203a8b.zip
FreeBSD-src-836035a4edf2d12174893117e0db29e309203a8b.tar.gz
Add 'options DEBUG_LOCKS', which stores extra information in struct
lock, and add some macros and function parameters to make sure that the information get to the point where it can be put in the lock structure. While I'm here, add DEBUG_VFS_LOCKS to LINT.
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 0903f6e..e832acf 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*
* @(#)kern_lock.c 8.18 (Berkeley) 5/21/95
- * $Id: kern_lock.c,v 1.21 1999/01/08 17:31:08 eivind Exp $
+ * $Id: kern_lock.c,v 1.22 1999/01/10 01:58:24 eivind Exp $
*/
#include "opt_lint.h"
@@ -171,11 +171,20 @@ acquire(struct lock *lkp, int extflags, int wanted) {
* accepted shared locks and shared-to-exclusive upgrades to go away.
*/
int
+#ifndef DEBUG_LOCKS
lockmgr(lkp, flags, interlkp, p)
+#else
+debuglockmgr(lkp, flags, interlkp, p, name, file, line)
+#endif
struct lock *lkp;
u_int flags;
struct simplelock *interlkp;
struct proc *p;
+#ifdef DEBUG_LOCKS
+ const char *name; /* Name of lock function */
+ const char *file; /* Name of file call is from */
+ int line; /* Line number in file */
+#endif
{
int error;
pid_t pid;
@@ -283,6 +292,11 @@ lockmgr(lkp, flags, interlkp, p)
panic("lockmgr: non-zero exclusive count");
#endif
lkp->lk_exclusivecount = 1;
+#if defined(DEBUG_LOCKS)
+ lkp->lk_filename = file;
+ lkp->lk_lineno = line;
+ lkp->lk_lockername = name;
+#endif
COUNT(p, 1);
break;
}
@@ -338,6 +352,11 @@ lockmgr(lkp, flags, interlkp, p)
panic("lockmgr: non-zero exclusive count");
#endif
lkp->lk_exclusivecount = 1;
+#if defined(DEBUG_LOCKS)
+ lkp->lk_filename = file;
+ lkp->lk_lineno = line;
+ lkp->lk_lockername = name;
+#endif
COUNT(p, 1);
break;
@@ -383,6 +402,11 @@ lockmgr(lkp, flags, interlkp, p)
lkp->lk_flags |= LK_DRAINING | LK_HAVE_EXCL;
lkp->lk_lockholder = pid;
lkp->lk_exclusivecount = 1;
+#if defined(DEBUG_LOCKS)
+ lkp->lk_filename = file;
+ lkp->lk_lineno = line;
+ lkp->lk_lockername = name;
+#endif
COUNT(p, 1);
break;
OpenPOWER on IntegriCloud