mirror of
https://github.com/opnsense/src.git
synced 2026-06-14 19:20:18 -04:00
Add macros to assert that the process is / isn't held in memory.
MFC after: 3 weeks
This commit is contained in:
parent
478d3f0901
commit
ab26caf6af
1 changed files with 6 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue