Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Jan 2008 22:20:24 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 132258 for review
Message-ID:  <200801012220.m01MKOU5042704@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=132258

Change 132258 by jb@jb_freebsd1 on 2008/01/01 22:19:46

	Update the prototype provider:
	- Add a SYSUNINIT.
	- Move code out of modevent to load/unload.
	- Add a dependency on the opensolaris module.
	
	Note that the prototype provider does no more than register itself
	as a provider. It's just a template for writing a new DTrace provider
	for FreeBSD to give a starting set of functions and include files
	in the absense of a DTrace provider writer's guide.

Affected files ...

.. //depot/projects/dtrace/src/sys/cddl/dev/prototype.c#5 edit

Differences ...

==== //depot/projects/dtrace/src/sys/cddl/dev/prototype.c#5 (text+ko) ====

@@ -18,7 +18,7 @@
  *
  * CDDL HEADER END
  *
- * Portions Copyright 2006 John Birrell jb@freebsd.org
+ * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
  *
  * $FreeBSD$
  *
@@ -32,7 +32,6 @@
 #include <sys/cdefs.h>
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/cpuvar.h>
 #include <sys/fcntl.h>
@@ -59,7 +58,7 @@
 #include <sys/unistd.h>
 #include <machine/stdarg.h>
 
-#include <contrib/opensolaris/uts/common/sys/dtrace_impl.h>
+#include <sys/dtrace_impl.h>
 #include <sys/sdt.h>
 
 static d_open_t	prototype_open;
@@ -129,6 +128,10 @@
 static void
 prototype_load(void *dummy)
 {
+	/* Create the /dev/dtrace/prototype entry. */
+	prototype_cdev = make_dev(&prototype_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
+	    "dtrace/prototype");
+
 	if (dtrace_register("prototype", &prototype_attr, DTRACE_PRIV_USER,
 	    NULL, &prototype_pops, NULL, &prototype_id) != 0)
 		return;
@@ -156,13 +159,9 @@
 
 	switch (type) {
 	case MOD_LOAD:
-		/* Create the /dev/dtrace/prototype entry. */
-		prototype_cdev = make_dev(&prototype_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
-		    "dtrace/prototype");
 		break;
 
 	case MOD_UNLOAD:
-		error = prototype_unload();
 		break;
 
 	case MOD_SHUTDOWN:
@@ -184,8 +183,10 @@
 	return (0);
 }
 
-SYSINIT(prototype_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_load, NULL)
+SYSINIT(prototype_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_load, NULL);
+SYSUNINIT(prototype_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, prototype_unload, NULL);
 
 DEV_MODULE(prototype, prototype_modevent, NULL);
 MODULE_VERSION(prototype, 1);
 MODULE_DEPEND(prototype, dtrace, 1, 1, 1);
+MODULE_DEPEND(prototype, opensolaris, 1, 1, 1);



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