From owner-svn-src-all@FreeBSD.ORG Fri Nov 21 05:25:02 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86F77245; Fri, 21 Nov 2014 05:25:02 +0000 (UTC) Received: from st11p02mm-asmtp002.mac.com (st11p02mm-asmtp002.mac.com [17.172.220.237]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E55C26EA; Fri, 21 Nov 2014 05:25:01 +0000 (UTC) Received: from fukuyama.hsd1.ca.comcast.net (unknown [73.162.13.215]) by st11p02mm-asmtp002.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTPSA id <0NFD00LELJ11HJ80@st11p02mm-asmtp002.mac.com>; Fri, 21 Nov 2014 05:24:39 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.28,0.0.0000 definitions=2014-11-21_03:2014-11-20,2014-11-21,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=20 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1411210047 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: svn commit: r274167 - in head/sys: kern sys From: Rui Paulo In-reply-to: <201411060812.sA68CZ2w007383@svn.freebsd.org> Date: Thu, 20 Nov 2014 21:24:37 -0800 Content-transfer-encoding: quoted-printable Message-id: References: <201411060812.sA68CZ2w007383@svn.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.1993) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org 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: Fri, 21 Nov 2014 05:25:02 -0000 On Nov 6, 2014, at 00:12, Mateusz Guzik wrote: >=20 > Author: mjg > Date: Thu Nov 6 08:12:34 2014 > New Revision: 274167 > URL: https://svnweb.freebsd.org/changeset/base/274167 >=20 > Log: > Add sysctl kern.proc.cwd >=20 > It returns only current working directory of given process which = saves a lot of > overhead over kern.proc.filedesc if given proc has a lot of open fds. >=20 > Submitted by: Tiwei Bie (slightly = modified) > X-Additional: JuniorJobs project >=20 > Modified: > head/sys/kern/kern_descrip.c > head/sys/sys/sysctl.h > head/sys/sys/user.h >=20 > Modified: head/sys/kern/kern_descrip.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_descrip.c Thu Nov 6 07:44:10 2014 = (r274166) > +++ head/sys/kern/kern_descrip.c Thu Nov 6 08:12:34 2014 = (r274167) > @@ -3406,6 +3406,73 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC > CTLFLAG_RD|CTLFLAG_MPSAFE, sysctl_kern_proc_filedesc, > "Process filedesc entries"); >=20 > +/* > + * Store a process current working directory information to sbuf. > + * > + * Takes a locked proc as argument, and returns with the proc = unlocked. I never really liked this approach because it makes it harder to see the = locking pattern. Why not call fdhold(p) in the sysctl handler, unlock the process, call = kern_proc_cwd_out() with an additional fdp argument, and then call = fddrop()? -- Rui Paulo