diff options
author | des <des@FreeBSD.org> | 2007-04-15 12:59:49 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2007-04-15 12:59:49 +0000 |
commit | a664da774a7b274eaa8eefb1289e8b5bc8fb7cf6 (patch) | |
tree | c790f28dedb95b63d4eb8fa3385e6173408614e5 /sys | |
parent | 0eed90f74a4d72aafe54a3effbef2ce8080f753b (diff) | |
download | FreeBSD-src-a664da774a7b274eaa8eefb1289e8b5bc8fb7cf6.zip FreeBSD-src-a664da774a7b274eaa8eefb1289e8b5bc8fb7cf6.tar.gz |
Add macros to assert that the process is / isn't held in memory.
MFC after: 3 weeks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/proc.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 72b171e..7d71b8c 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)) |