Add macros to assert that the process is / isn't held in memory.

MFC after:	3 weeks
This commit is contained in:
des 2007-04-15 12:59:49 +00:00
parent 0eed90f74a
commit a664da774a

View File

@ -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))