aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2000-12-06 02:01:56 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2000-12-06 02:01:56 +0000
commit495c2d2085db31a234439c4872abed79e1f2a2a7 (patch)
tree4261a874a5a5f1c0b8d2877cffff5d790afb3f77 /sys
parentf3b0f821b01bc847dad6e79746ce51104fe1bbed (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/sys/proc.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index beed0792ffe91..d29b63690869a 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -383,12 +383,24 @@ sigonstack(size_t sp)
} \
} while (0)
+/* Lock and unlock a process. */
+#define PROC_LOCK(p) mtx_enter(&(p)->p_mtx, MTX_DEF)
+#define PROC_UNLOCK(p) mtx_exit(&(p)->p_mtx, MTX_DEF)
+
/* Hold process U-area in memory, normally for ptrace/procfs work. */
#define PHOLD(p) do { \
- if ((p)->p_lock++ == 0 && ((p)->p_flag & P_INMEM) == 0) \
+ PROC_LOCK(p); \
+ if ((p)->p_lock++ == 0 && ((p)->p_flag & P_INMEM) == 0) { \
+ PROC_UNLOCK(p); \
faultin(p); \
+ } else \
+ PROC_UNLOCK(p); \
+} while(0)
+#define PRELE(p) do { \
+ PROC_LOCK(p); \
+ (--(p)->p_lock); \
+ PROC_UNLOCK(p); \
} while(0)
-#define PRELE(p) (--(p)->p_lock)
#define PIDHASH(pid) (&pidhashtbl[(pid) & pidhash])
extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;