Date: Wed, 3 Sep 2014 14:20:18 +0200 From: Mateusz Guzik <mjguzik@gmail.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik <mjg@FreeBSD.org> Subject: Re: svn commit: r270993 - head/sys/kern Message-ID: <20140903122018.GC13871@dft-labs.eu> In-Reply-To: <20140903071629.GG2737@kib.kiev.ua> References: <201409030625.s836PZHY032159@svn.freebsd.org> <20140903071629.GG2737@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 03, 2014 at 10:16:29AM +0300, Konstantin Belousov wrote: > On Wed, Sep 03, 2014 at 06:25:35AM +0000, Mateusz Guzik wrote: > > 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 > No, this is my bug. Thank you for fixing it. It is a consequence of > the last minute 'safety' change I did. > I used it without veryfing it returns correct results. I'm happy to share the blame. :> > > Reported by: many > > MFC after: 1 week > I suggest to merge in 3 days. > Ok. > > > > 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. */ -- Mateusz Guzik <mjguzik gmail.com>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140903122018.GC13871>