summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2010-09-09 09:58:05 +0000
committerrpaulo <rpaulo@FreeBSD.org>2010-09-09 09:58:05 +0000
commita2f2f93652c6110c2d126720bc696a507347df3c (patch)
tree570bf6fe0f56cd9d114a4ca79312445ce08fd1a2 /sys/kern/kern_fork.c
parent621aa135f858acaa543db9487a3c567e62e86bf0 (diff)
downloadFreeBSD-src-a2f2f93652c6110c2d126720bc696a507347df3c.zip
FreeBSD-src-a2f2f93652c6110c2d126720bc696a507347df3c.tar.gz
Fix two bugs in DTrace:
* when the process exits, remove the associated USDT probes * when the process forks, duplicate the USDT probes. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 29aa121..81631f6 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -671,15 +671,6 @@ again:
p2->p_pfsflags = p1->p_pfsflags;
}
-#ifdef KDTRACE_HOOKS
- /*
- * Tell the DTrace fasttrap provider about the new process
- * if it has registered an interest.
- */
- if (dtrace_fasttrap_fork)
- dtrace_fasttrap_fork(p1, p2);
-#endif
-
/*
* This begins the section where we must prevent the parent
* from being swapped.
@@ -744,6 +735,21 @@ again:
PROC_SLOCK(p2);
p2->p_state = PRS_NORMAL;
PROC_SUNLOCK(p2);
+#ifdef KDTRACE_HOOKS
+ /*
+ * Tell the DTrace fasttrap provider about the new process
+ * if it has registered an interest. We have to do this only after
+ * p_state is PRS_NORMAL since the fasttrap module will use pfind()
+ * later on.
+ */
+ if (dtrace_fasttrap_fork) {
+ PROC_LOCK(p1);
+ PROC_LOCK(p2);
+ dtrace_fasttrap_fork(p1, p2);
+ PROC_UNLOCK(p2);
+ PROC_UNLOCK(p1);
+ }
+#endif
/*
* If RFSTOPPED not requested, make child runnable and add to
OpenPOWER on IntegriCloud