diff options
author | peter <peter@FreeBSD.org> | 1997-03-25 16:32:46 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1997-03-25 16:32:46 +0000 |
commit | 65d2feb26ce02cbe17ed1a54ee52b0a26141198a (patch) | |
tree | 7d33c629e4b5d817730e710264f6903465a6911e /sys/kern | |
parent | b872711565cedaaf045e1360d285d0fa4306044a (diff) | |
download | FreeBSD-src-65d2feb26ce02cbe17ed1a54ee52b0a26141198a.zip FreeBSD-src-65d2feb26ce02cbe17ed1a54ee52b0a26141198a.tar.gz |
Replace original revision 1.1; Author dyson; Date: 1997/02/10 02:28:15
Changes from Lite2:
- DEBUG -> SIMPLELOCK_DEBUG
- cosmetic fixes
- bzero of lock at init time -> explicit init of members.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lock.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index ddc9185..9710b8e 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -117,12 +117,14 @@ lockinit(lkp, prio, wmesg, timo, flags) int flags; { - bzero(lkp, sizeof(struct lock)); simple_lock_init(&lkp->lk_interlock); lkp->lk_flags = flags & LK_EXTFLG_MASK; + lkp->lk_sharecount = 0; + lkp->lk_waitcount = 0; + lkp->lk_exclusivecount = 0; lkp->lk_prio = prio; - lkp->lk_timo = timo; lkp->lk_wmesg = wmesg; + lkp->lk_timo = timo; lkp->lk_lockholder = LK_NOPROC; } @@ -168,8 +170,9 @@ lockmgr(lkp, flags, interlkp, p) else pid = LK_KERNPROC; simple_lock(&lkp->lk_interlock); - if (flags & LK_INTERLOCK) + if (flags & LK_INTERLOCK) { simple_unlock(interlkp); + } extflags = (flags | lkp->lk_flags) & LK_EXTFLG_MASK; #ifdef DIAGNOSTIC /* @@ -425,6 +428,7 @@ lockmgr(lkp, flags, interlkp, p) * Print out information about state of a lock. Used by VOP_PRINT * routines to display ststus about contained locks. */ +void lockmgr_printinfo(lkp) struct lock *lkp; { @@ -439,12 +443,12 @@ lockmgr_printinfo(lkp) printf(" with %d pending", lkp->lk_waitcount); } -#if defined(DEBUG) && NCPUS == 1 +#if defined(SIMPLELOCK_DEBUG) && NCPUS == 1 #include <sys/kernel.h> #include <vm/vm.h> #include <sys/sysctl.h> int lockpausetime = 0; -struct ctldebug debug2 = { "lockpausetime", &lockpausetime }; +/* struct ctldebug debug2 = { "lockpausetime", &lockpausetime }; */ int simplelockrecurse; /* * Simple lock functions so that the debugger can see from whence @@ -472,7 +476,8 @@ _simple_lock(alp, id, l) panic("%s:%d: simple_lock: lock held", id, l); printf("%s:%d: simple_lock: lock held\n", id, l); if (lockpausetime == 1) { - BACKTRACE(curproc); + Debugger("simple_lock"); + /*BACKTRACE(curproc); */ } else if (lockpausetime > 1) { printf("%s:%d: simple_lock: lock held...", id, l); tsleep(&lockpausetime, PCATCH | PPAUSE, "slock", @@ -516,7 +521,8 @@ _simple_unlock(alp, id, l) panic("%s:%d: simple_unlock: lock not held", id, l); printf("%s:%d: simple_unlock: lock not held\n", id, l); if (lockpausetime == 1) { - BACKTRACE(curproc); + Debugger("simple_unlock"); + /* BACKTRACE(curproc); */ } else if (lockpausetime > 1) { printf("%s:%d: simple_unlock: lock not held...", id, l); tsleep(&lockpausetime, PCATCH | PPAUSE, "sunlock", @@ -528,4 +534,4 @@ _simple_unlock(alp, id, l) if (curproc) curproc->p_simple_locks--; } -#endif /* DEBUG && NCPUS == 1 */ +#endif /* SIMPLELOCK_DEBUG && NCPUS == 1 */ |