Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Apr 2013 17:44:30 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r249240 - head/sys/kern
Message-ID:  <201304071744.r37HiUq7034335@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Sun Apr  7 17:44:30 2013
New Revision: 249240
URL: http://svnweb.freebsd.org/changeset/base/249240

Log:
  Use pget(9) to reduce code duplication.
  
  MFC after:	1 week

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Sun Apr  7 17:42:27 2013	(r249239)
+++ head/sys/kern/kern_descrip.c	Sun Apr  7 17:44:30 2013	(r249240)
@@ -2944,12 +2944,9 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE
 	struct tty *tp;
 
 	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)
@@ -3239,12 +3236,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?201304071744.r37HiUq7034335>