svn commit: r249240 - head/sys/kern
Mikolaj Golub
trociny at FreeBSD.org
Sun Apr 7 17:44:31 UTC 2013
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)
More information about the svn-src-head
mailing list