diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 72b171e7b5b..7d71b8cc2dd 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -746,6 +746,9 @@ MALLOC_DECLARE(M_ZOMBIE); if (((p)->p_sflag & PS_INMEM) == 0) \ faultin((p)); \ } while (0) +#define PROC_ASSERT_HELD(p) do { \ + KASSERT((p)->p_lock > 0, ("process not held")); \ +} while (0) #define PRELE(p) do { \ PROC_LOCK((p)); \ @@ -758,6 +761,9 @@ MALLOC_DECLARE(M_ZOMBIE); if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0) \ wakeup(&(p)->p_lock); \ } while (0) +#define PROC_ASSERT_NOT_HELD(p) do { \ + KASSERT((p)->p_lock == 0, ("process held")); \ +} while (0) /* Check whether a thread is safe to be swapped out. */ #define thread_safetoswapout(td) (TD_IS_SLEEPING(td) || TD_IS_SUSPENDED(td))