svn commit: r270993 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Wed Sep 3 06:25:35 UTC 2014
Author: mjg
Date: Wed Sep 3 06:25:34 2014
New Revision: 270993
URL: http://svnweb.freebsd.org/changeset/base/270993
Log:
Fix up proc_realparent to always return correct process.
Prior to the change it would always return initproc for non-traced processes.
This fixes ps apparently always returning 1 as ppid.
Pointy hat: mjg
Reported by: many
MFC after: 1 week
Modified:
head/sys/kern/kern_exit.c
Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c Wed Sep 3 05:14:50 2014 (r270992)
+++ head/sys/kern/kern_exit.c Wed Sep 3 06:25:34 2014 (r270993)
@@ -104,8 +104,12 @@ proc_realparent(struct proc *child)
sx_assert(&proctree_lock, SX_LOCKED);
if ((child->p_treeflag & P_TREE_ORPHANED) == 0) {
- return (child->p_pptr->p_pid == child->p_oppid ?
- child->p_pptr : initproc);
+ if (child->p_oppid == 0 ||
+ child->p_pptr->p_pid == child->p_oppid)
+ parent = child->p_pptr;
+ else
+ parent = initproc;
+ return (parent);
}
for (p = child; (p->p_treeflag & P_TREE_FIRST_ORPHAN) == 0;) {
/* Cannot use LIST_PREV(), since the list head is not known. */
More information about the svn-src-all
mailing list