[Midnightbsd-cvs] src [6580] bring in changes from freebsd 9.2 to filemon

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Dec 29 22:48:20 EST 2013


Revision: 6580
          http://svnweb.midnightbsd.org/src/?rev=6580
Author:   laffer1
Date:     2013-12-29 22:48:20 -0500 (Sun, 29 Dec 2013)
Log Message:
-----------
bring in changes from freebsd 9.2 to filemon

Modified Paths:
--------------
    trunk/sys/dev/filemon/filemon.c
    trunk/sys/dev/filemon/filemon_wrapper.c
    trunk/sys/modules/filemon/Makefile

Property Changed:
----------------
    trunk/sys/modules/filemon/Makefile

Modified: trunk/sys/dev/filemon/filemon.c
===================================================================
--- trunk/sys/dev/filemon/filemon.c	2013-12-30 03:40:52 UTC (rev 6579)
+++ trunk/sys/dev/filemon/filemon.c	2013-12-30 03:48:20 UTC (rev 6580)
@@ -178,6 +178,7 @@
 {
 	int error = 0;
 	struct filemon *filemon;
+	struct proc *p;
 
 #if __FreeBSD_version < 701000
 	filemon = dev->si_drv1;
@@ -200,7 +201,12 @@
 
 	/* Set the monitored process ID. */
 	case FILEMON_SET_PID:
-		filemon->pid = *((pid_t *) data);
+		error = pget(*((pid_t *)data), PGET_CANDEBUG | PGET_NOTWEXIT,
+		    &p);
+		if (error == 0) {
+			filemon->pid = p->p_pid;
+			PROC_UNLOCK(p);
+		}
 		break;
 
 	default:

Modified: trunk/sys/dev/filemon/filemon_wrapper.c
===================================================================
--- trunk/sys/dev/filemon/filemon_wrapper.c	2013-12-30 03:40:52 UTC (rev 6579)
+++ trunk/sys/dev/filemon/filemon_wrapper.c	2013-12-30 03:48:20 UTC (rev 6580)
@@ -28,9 +28,9 @@
 #include <sys/cdefs.h>
 __MBSDID("$MidnightBSD$");
 
-#if __FreeBSD_version > 800032
+#include "opt_compat.h"
+
 #define FILEMON_HAS_LINKAT
-#endif
 
 #if __FreeBSD_version < 900044	/* r225617 (2011-09-16) failed to bump
 				   __FreeBSD_version.  This really should
@@ -82,15 +82,14 @@
 {
 	struct filemon *filemon;
 
-	TAILQ_FOREACH(filemon, &filemons_inuse, link) {
-		if (p->p_pid == filemon->pid)
-			return (filemon);
+	while (p->p_pptr) {
+		TAILQ_FOREACH(filemon, &filemons_inuse, link) {
+			if (p->p_pid == filemon->pid)
+				return (filemon);
+		}
+		p = p->p_pptr;
 	}
-
-	if (p->p_pptr == NULL)
-		return (NULL);
-
-	return (filemon_pid_check(p->p_pptr));
+	return (NULL);
 }
 
 static void
@@ -573,6 +572,7 @@
 			    (uintmax_t)now.tv_sec, (uintmax_t)now.tv_usec);
 
 			filemon_output(filemon, filemon->msgbufr, len);
+			filemon->pid = -1;
 		}
 
 		/* Unlock the found filemon structure. */

Modified: trunk/sys/modules/filemon/Makefile
===================================================================
--- trunk/sys/modules/filemon/Makefile	2013-12-30 03:40:52 UTC (rev 6579)
+++ trunk/sys/modules/filemon/Makefile	2013-12-30 03:48:20 UTC (rev 6580)
@@ -1,11 +1,9 @@
-# $FreeBSD$
+# $MidnightBSD$
 
-MAINTAINER=	obrien at FreeBSD.org
-
 .PATH: ${.CURDIR}/../../dev/filemon
 
 KMOD=	filemon
 SRCS=	${KMOD}.c
-SRCS+=	vnode_if.h opt_compat.h opt_capsicum.h
+SRCS+=	opt_compat.h
 
 .include <bsd.kmod.mk>


Property changes on: trunk/sys/modules/filemon/Makefile
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
## -1 +0,0 ##
-1.1.1.1
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list