From owner-svn-src-all@FreeBSD.ORG Wed Sep 3 12:20:28 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D1A4CCC6; Wed, 3 Sep 2014 12:20:28 +0000 (UTC) Received: from mail-we0-x233.google.com (mail-we0-x233.google.com [IPv6:2a00:1450:400c:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EEB4B1E62; Wed, 3 Sep 2014 12:20:27 +0000 (UTC) Received: by mail-we0-f179.google.com with SMTP id t60so8426730wes.38 for ; Wed, 03 Sep 2014 05:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=wpe7n3WYQFet+yr8O8wfVEuIUHJQBo8aLkDVZWZBwoE=; b=ID9NZNm5ok0sGiHT+qNHaXNzYj5+gSEyK/0ixARYy9z1v73QP6B5xE7hrdoiojcrEm AOT7NP99YJGbUj+VPxxoPQUlO58tUE+PY2dWKWKgSUYBC1hHDsdSC8UqQKbbNo3VR/Wn L/cVdB/E1w4kcGGcAKIT8L90pdWJuZfmwUm+OxsN0NsWNtxPYbfllkvFywIJy1xfTzo3 Q8vx0lnQGkQr0IbdyvLjBNJzh2q0xkrKq4AMkKobEI7FXCpDdAzLpBG95uXeOegKt0tO jQZ7Mq8dYCbtjImBopwaWRwJknaDpODD4+miQ8B1ojXPm4Hh7/2+hiGTQGE/3sF5d5C5 GBLw== X-Received: by 10.180.207.6 with SMTP id ls6mr25009371wic.48.1409746824637; Wed, 03 Sep 2014 05:20:24 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id mx19sm4480878wic.3.2014.09.03.05.20.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 05:20:23 -0700 (PDT) Date: Wed, 3 Sep 2014 14:20:18 +0200 From: Mateusz Guzik To: Konstantin Belousov Subject: Re: svn commit: r270993 - head/sys/kern Message-ID: <20140903122018.GC13871@dft-labs.eu> References: <201409030625.s836PZHY032159@svn.freebsd.org> <20140903071629.GG2737@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20140903071629.GG2737@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Sep 2014 12:20:28 -0000 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