From 52e95a64eac4b9f0041f69c332d34bbc76207c2f Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Fri, 17 Jun 2011 21:44:13 +0000 Subject: Add comment from CSRG rev 7.27 (1992/06/23 19:56:55; author: mckusick) --- sys/kern/sys_process.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sys/kern/sys_process.c') 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) { -- cgit v1.2.3