svn commit: r249522 - stable/9/sys/kern

Mikolaj Golub trociny at FreeBSD.org
Mon Apr 15 18:56:03 UTC 2013


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)


More information about the svn-src-stable-9 mailing list