Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Jun 2006 21:54:37 GMT
From:      John Birrell <jb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 98884 for review
Message-ID:  <200606092154.k59LsbYb029498@repoman.freebsd.org>

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

Change 98884 by jb@jb_freebsd2 on 2006/06/09 21:53:53

	Add a loader menu option to load the DTrace modules before booting.
	This isn't implemented in Forth (like the acpi load wasn't) because
	the support.4th code is all centred around processing configuration
	files and all that has happened before the menu is displayed.
	
	We need an active committer who knows Forth. Despite the commit
	comment by the author of support.4th, this code is far from documented
	and light years away from being readable. It's like someone just
	dropped a million words in a file and called it "code". Yuk. I've
	wasted enough time trying to understand it.

Affected files ...

.. //depot/projects/dtrace/src/sys/boot/forth/beastie.4th#2 edit
.. //depot/projects/dtrace/src/sys/boot/i386/libi386/i386_module.c#2 edit

Differences ...

==== //depot/projects/dtrace/src/sys/boot/forth/beastie.4th#2 (text+ko) ====

@@ -40,6 +40,7 @@
 
 variable bootkey
 variable bootacpikey
+variable bootdtracekey
 variable bootsafekey
 variable bootverbosekey
 variable bootsinglekey
@@ -194,6 +195,7 @@
 	printmenuitem ."  Boot FreeBSD in Safe Mode" bootsafekey !
 	printmenuitem ."  Boot FreeBSD in single user mode" bootsinglekey !
 	printmenuitem ."  Boot FreeBSD with verbose logging" bootverbosekey !
+	printmenuitem ."  Boot FreeBSD with DTrace enabled" bootdtracekey !
 	printmenuitem ."  Escape to loader prompt" escapekey !
 	printmenuitem ."  Reboot" rebootkey !
 	menuX @ 20 at-xy
@@ -283,6 +285,10 @@
 			s" YES" s" boot_single" setenv
 			0 boot
 		then
+		dup bootdtracekey @ = if
+			s" YES" s" dtrace_load" setenv
+			0 boot
+		then
 		dup escapekey @ = if
 			2drop
 			s" NO" s" autoboot_delay" setenv

==== //depot/projects/dtrace/src/sys/boot/i386/libi386/i386_module.c#2 (text+ko) ====

@@ -64,5 +64,31 @@
 	    printf("ACPI autoload failed - %s\n", strerror(error));
     }
 
+    /*
+     * XXX This stuff should be in 4th too, but who can understand
+     * how to load a module from a menu option? The support.4th
+     * code loads modules before the menu.
+     */
+    if (getenv("dtrace_load")) {
+	error = mod_load("cyclic", NULL, 0, NULL);
+	if (error != 0)
+	    printf("cyclic autoload failed - %s\n", strerror(error));
+	error = mod_load("dtrace", NULL, 0, NULL);
+	if (error != 0)
+	    printf("dtrace autoload failed - %s\n", strerror(error));
+	error = mod_load("profile", NULL, 0, NULL);
+	if (error != 0)
+	    printf("profile autoload failed - %s\n", strerror(error));
+	error = mod_load("systrace", NULL, 0, NULL);
+	if (error != 0)
+	    printf("systrace autoload failed - %s\n", strerror(error));
+	error = mod_load("fbt", NULL, 0, NULL);
+	if (error != 0)
+	    printf("fbt autoload failed - %s\n", strerror(error));
+	error = mod_load("sdt", NULL, 0, NULL);
+	if (error != 0)
+	    printf("sdt autoload failed - %s\n", strerror(error));
+    }
+
     return(0);
 }



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