Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Apr 2013 18:56:03 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r249522 - stable/9/sys/kern
Message-ID:  <201304151856.r3FIu3eX031922@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Mon Apr 15 18:56:03 2013
New Revision: 249522
URL: http://svnweb.freebsd.org/changeset/base/249522

Log:
  MFC r249240:
  
  Use pget(9) to reduce code duplication.

Modified:
  stable/9/sys/kern/kern_descrip.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_descrip.c
==============================================================================
--- stable/9/sys/kern/kern_descrip.c	Mon Apr 15 18:38:21 2013	(r249521)
+++ stable/9/sys/kern/kern_descrip.c	Mon Apr 15 18:56:03 2013	(r249522)
@@ -3013,12 +3013,9 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
 	int vfslocked;
 
 	name = (int *)arg1;
-	if ((p = pfind((pid_t)name[0])) == NULL)
-		return (ESRCH);
-	if ((error = p_candebug(curthread, p))) {
-		PROC_UNLOCK(p);
+	error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
+	if (error != 0)
 		return (error);
-	}
 	fdp = fdhold(p);
 	PROC_UNLOCK(p);
 	if (fdp == NULL)
@@ -3330,12 +3327,9 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER
 	cap_rights_t fd_cap_rights;
 
 	name = (int *)arg1;
-	if ((p = pfind((pid_t)name[0])) == NULL)
-		return (ESRCH);
-	if ((error = p_candebug(curthread, p))) {
-		PROC_UNLOCK(p);
+	error = pget((pid_t)name[0], PGET_CANDEBUG, &p);
+	if (error != 0)
 		return (error);
-	}
 	/* ktrace vnode */
 	tracevp = p->p_tracevp;
 	if (tracevp != NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304151856.r3FIu3eX031922>