From owner-svn-src-stable-10@FreeBSD.ORG Fri Aug 22 15:00:48 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63E5B860; Fri, 22 Aug 2014 15:00:48 +0000 (UTC) Received: from mail-qg0-x22d.google.com (mail-qg0-x22d.google.com [IPv6:2607:f8b0:400d:c04::22d]) (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 DC05D3C18; Fri, 22 Aug 2014 15:00:47 +0000 (UTC) Received: by mail-qg0-f45.google.com with SMTP id f51so10250960qge.4 for ; Fri, 22 Aug 2014 08:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=EDbv2Pn+2YrfepncFSYyQQhBXtJNibt8LvasFTm2VGY=; b=XldTCpviMh1MpaC9UXfB6DgHtUuMCNvYkWS7Vt6tNSkkhDoxvKsM3AePEGwPVQQV8L Y7qT82ZCpKRZA8EicU6J2KcREiA+QZJp/N07z95cdPLkufifqF+U02xldliZxp2aoC4/ cdxZO0tBF6F+h+9r6SG+96vb3AE70G4ORWWBhKA26ndDapCjf7hF1EnpAgwgicDf2r8Y Z6q38AMtpIA4pMJtAbOYO722bFJb5lBNP0pHQbrWEwuAhHqXNiQN16WnuVCjXHLSELf/ LnHywYcciyJNrEtxNVXqsGsyIQXTHxJMb5k/XWsM5iwqPvsgI+LN+OAv3yoxo4Wbd/CI uwSQ== X-Received: by 10.140.89.5 with SMTP id u5mr8516116qgd.14.1408719646985; Fri, 22 Aug 2014 08:00:46 -0700 (PDT) Received: from charmander.home ([65.92.193.222]) by mx.google.com with ESMTPSA id x14sm35386825qae.13.2014.08.22.08.00.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Aug 2014 08:00:46 -0700 (PDT) Sender: Mark Johnston Date: Fri, 22 Aug 2014 10:59:28 -0400 From: Mark Johnston To: Konstantin Belousov Subject: Re: svn commit: r270294 - stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace Message-ID: <20140822145928.GA75918@charmander.home> References: <201408211945.s7LJjqST049739@svn.freebsd.org> <20140822062207.GK2737@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140822062207.GK2737@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-10@freebsd.org X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Aug 2014 15:00:48 -0000 On Fri, Aug 22, 2014 at 09:22:07AM +0300, Konstantin Belousov wrote: > On Thu, Aug 21, 2014 at 07:45:52PM +0000, Mark Johnston wrote: > > Author: markj > > Date: Thu Aug 21 19:45:52 2014 > > New Revision: 270294 > > URL: http://svnweb.freebsd.org/changeset/base/270294 > > > > Log: > > MFC r269525: > > Return 0 for the PPID of threads in process 0, as process 0 doesn't have a > > parent process. > > > > Modified: > > stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > > Directory Properties: > > stable/10/ (props changed) > > > > Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > > ============================================================================== > > --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Aug 21 19:42:24 2014 (r270293) > > +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Thu Aug 21 19:45:52 2014 (r270294) > > @@ -3415,7 +3415,10 @@ dtrace_dif_variable(dtrace_mstate_t *mst > > */ > > return ((uint64_t)curthread->t_procp->p_ppid); > > #else > > - return ((uint64_t)curproc->p_pptr->p_pid); > > + if (curproc->p_pid == proc0.p_pid) > > + return (curproc->p_pid); > > + else > > + return (curproc->p_pptr->p_pid); > > #endif > > > > case DIF_VAR_TID: > BTW, does the code look for the parent, or for the debugger of the current > process ? I mean, should the snippet above use p_pptr or real_parent() ? It should return the parent of the process; it's effectively an implementation of getppid() for DTrace scripts. proc_realparent() requires the proctree lock to be held though, so it can't really be used here. This code is in the DTrace probe handler, so it runs with interrupts disabled, and it also could be called from a context where the shared lock is already held.