summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2012-02-10 00:02:13 +0000
committerkib <kib@FreeBSD.org>2012-02-10 00:02:13 +0000
commit956d09353b3831c6d61a9eee9ce9572333b1e8ed (patch)
tree6c1604f05fbb306e388325c5cec342e42e38433c /sys/kern
parent1a089455d64a86fb9e288851d23455f9390f4912 (diff)
downloadFreeBSD-src-956d09353b3831c6d61a9eee9ce9572333b1e8ed.zip
FreeBSD-src-956d09353b3831c6d61a9eee9ce9572333b1e8ed.tar.gz
Mark the automatically attached child with PL_FLAG_CHILD in struct
lwpinfo flags, for PT_FOLLOWFORK auto-attachment. In collaboration with: Dmitry Mikulin <dmitrym juniper net> MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_fork.c2
-rw-r--r--sys/kern/sys_process.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 60639c9..e447c93 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -1035,7 +1035,9 @@ fork_return(struct thread *td, struct trapframe *frame)
p->p_oppid = p->p_pptr->p_pid;
proc_reparent(p, dbg);
sx_xunlock(&proctree_lock);
+ td->td_dbgflags |= TDB_CHILD;
ptracestop(td, SIGSTOP);
+ td->td_dbgflags &= ~TDB_CHILD;
} else {
/*
* ... otherwise clear the request.
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 4510380..2060efe 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -1145,6 +1145,8 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
pl->pl_flags |= PL_FLAG_FORKED;
pl->pl_child_pid = td2->td_dbg_forked;
}
+ if (td2->td_dbgflags & TDB_CHILD)
+ pl->pl_flags |= PL_FLAG_CHILD;
pl->pl_sigmask = td2->td_sigmask;
pl->pl_siglist = td2->td_siglist;
strcpy(pl->pl_tdname, td2->td_name);
OpenPOWER on IntegriCloud