*/
#include <sys/param.h>
-#include <sys/proc.h>
+#include <sys/proc_internal.h>
#include <sys/lock.h>
#include <kern/cpu_number.h>
#include <kern/thread.h>
if (lock_wait_time > 0) { \
int i; \
\
- simple_unlock(&lkp->lk_interlock); \
for (i = lock_wait_time; i > 0; i--) \
if (!(wanted)) \
break; \
- simple_lock(&lkp->lk_interlock); \
} \
if (!(wanted)) \
break;
PAUSE(lkp, wanted); \
for (error = 0; wanted; ) { \
(lkp)->lk_waitcount++; \
- simple_unlock(&(lkp)->lk_interlock); \
error = tsleep((void *)lkp, (lkp)->lk_prio, \
(lkp)->lk_wmesg, (lkp)->lk_timo); \
- simple_lock(&(lkp)->lk_interlock); \
(lkp)->lk_waitcount--; \
if (error) \
break; \
lockinit(lkp, prio, wmesg, timo, flags)
struct lock__bsd__ *lkp;
int prio;
- char *wmesg;
+ const char *wmesg;
int timo;
int flags;
{
bzero(lkp, sizeof(struct lock__bsd__));
- simple_lock_init(&lkp->lk_interlock);
lkp->lk_flags = flags & LK_EXTFLG_MASK;
lkp->lk_prio = prio;
lkp->lk_timo = timo;
{
int lock_type = 0;
- simple_lock(&lkp->lk_interlock);
if (lkp->lk_exclusivecount != 0)
lock_type = LK_EXCLUSIVE;
else if (lkp->lk_sharecount != 0)
lock_type = LK_SHARED;
- simple_unlock(&lkp->lk_interlock);
return (lock_type);
}
lockmgr(lkp, flags, interlkp, p)
struct lock__bsd__ *lkp;
u_int flags;
- simple_lock_t interlkp;
+ void * interlkp;
struct proc *p;
{
int error;
pid = p->p_pid;
else
pid = LK_KERNPROC;
- simple_lock(&lkp->lk_interlock);
- if (flags & LK_INTERLOCK)
- simple_unlock(interlkp);
extflags = (flags | lkp->lk_flags) & LK_EXTFLG_MASK;
#if 0
/*
(LK_HAVE_EXCL | LK_WANT_EXCL | LK_WANT_UPGRADE)) ||
lkp->lk_sharecount != 0 || lkp->lk_waitcount != 0); ) {
lkp->lk_flags |= LK_WAITDRAIN;
- simple_unlock(&lkp->lk_interlock);
if (error = tsleep((void *)&lkp->lk_flags, lkp->lk_prio,
lkp->lk_wmesg, lkp->lk_timo))
return (error);
if ((extflags) & LK_SLEEPFAIL)
return (ENOLCK);
- simple_lock(&lkp->lk_interlock);
}
lkp->lk_flags |= LK_DRAINING | LK_HAVE_EXCL;
lkp->lk_lockholder = pid;
break;
default:
- simple_unlock(&lkp->lk_interlock);
panic("lockmgr: unknown locktype request %d",
flags & LK_TYPE_MASK);
/* NOTREACHED */
lkp->lk_flags &= ~LK_WAITDRAIN;
wakeup((void *)&lkp->lk_flags);
}
- simple_unlock(&lkp->lk_interlock);
return (error);
}
* 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__bsd__ *lkp;
{