aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2011-06-17 21:44:13 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2011-06-17 21:44:13 +0000
commit52e95a64eac4b9f0041f69c332d34bbc76207c2f (patch)
tree3579be18eecbdf6b58fa1740cb4276052f4f4d87 /sys/kern/sys_process.c
parent5df88f46bbf686ad9a6f3ace974ff0d764d48cd8 (diff)
downloadsrc-52e95a64eac4b9f0041f69c332d34bbc76207c2f.tar.gz
src-52e95a64eac4b9f0041f69c332d34bbc76207c2f.zip
Add comment from CSRG rev 7.27 (1992/06/23 19:56:55; author: mckusick)
Notes
Notes: svn path=/head/; revision=223212
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index a4c0069bcf8c..ee36b3512f5a 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -829,6 +829,15 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
case PT_ATTACH:
/* security check done above */
+ /*
+ * It would be nice if the tracing relationship was separate
+ * from the parent relationship but that would require
+ * another set of links in the proc struct or for "wait"
+ * to scan the entire proc table. To make life easier,
+ * we just re-parent the process we're trying to trace.
+ * The old parent is remembered so we can put things back
+ * on a "detach".
+ */
p->p_flag |= P_TRACED;
p->p_oppid = p->p_pptr->p_pid;
if (p->p_pptr != td->td_proc) {