1 #include <netgraph7/ng_message.h>
3 #include <sys/malloc.h>
4 #include <sys/linker.h>
5 #include <sys/thread2.h>
10 /* Temporary lock stuff. */
12 /* End Temporary lock stuff. */
20 lockstatus_owned(struct lock *lkp, struct thread *td)
24 if (lkp->lk_exclusivecount != 0) {
25 if (td == NULL || lkp->lk_lockholder == td)
26 lock_type = LK_EXCLUSIVE;
28 lock_type = LK_EXCLOTHER;
29 } else if (lkp->lk_sharecount != 0) {
30 lock_type = LK_SHARED;
36 * Atomically drop a lockmgr lock and go to sleep. The lock is reacquired
37 * before returning from this function. Passes on the value returned by
41 lock_sleep(void *ident, int flags, const char *wmesg, int timo,
46 mode = lockstatus_owned(lk, curthread);
47 KKASSERT((mode == LK_EXCLUSIVE) || (mode == LK_SHARED));
50 tsleep_interlock(ident, flags);
51 lockmgr(lk, LK_RELEASE);
52 err = tsleep(ident, flags, wmesg, timo);