]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/kern_lock.c
xnu-792.1.5.tar.gz
[apple/xnu.git] / bsd / kern / kern_lock.c
index d8ba1e858b0078cd110e9885eef62c6eddd8a0ad..c69140fdab9789272560c7ffa6d0f817ef9bdbc8 100644 (file)
@@ -60,7 +60,7 @@
  */
 
 #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>
@@ -91,11 +91,9 @@ int lock_wait_time = 100;
                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;
@@ -117,10 +115,8 @@ int lock_wait_time = 100;
        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;                                          \
@@ -137,13 +133,12 @@ void
 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;
@@ -161,12 +156,10 @@ lockstatus(lkp)
 {
        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);
 }
 
@@ -181,7 +174,7 @@ int
 lockmgr(lkp, flags, interlkp, p)
        struct lock__bsd__ *lkp;
        u_int flags;
-       simple_lock_t interlkp;
+       void * interlkp;
        struct proc *p;
 {
        int error;
@@ -194,9 +187,6 @@ lockmgr(lkp, flags, interlkp, p)
                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
        /*
@@ -429,13 +419,11 @@ lockmgr(lkp, flags, interlkp, p)
                     (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;
@@ -445,7 +433,6 @@ lockmgr(lkp, flags, interlkp, p)
                break;
 
        default:
-               simple_unlock(&lkp->lk_interlock);
                panic("lockmgr: unknown locktype request %d",
                    flags & LK_TYPE_MASK);
                /* NOTREACHED */
@@ -456,7 +443,6 @@ lockmgr(lkp, flags, interlkp, p)
                lkp->lk_flags &= ~LK_WAITDRAIN;
                wakeup((void *)&lkp->lk_flags);
        }
-       simple_unlock(&lkp->lk_interlock);
        return (error);
 }
 
@@ -464,6 +450,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__bsd__ *lkp;
 {