PERFORCE change 96358 for review

John Birrell jb at FreeBSD.org
Sat Apr 29 11:57:34 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=96358

Change 96358 by jb at jb_freebsd2 on 2006/04/29 11:56:36

	Change the module naming convention. I was just using the full file name,
	but the DTrace parse syntax rejects slashes and dots, so replace those
	two characters with underscores. This means that /boot/kernel/dtrace.ko
	becomes _boot_kernel_dtrace_ko.
	
	With this change it's possible to access static variables of the same name
	in different modules. As an example I added 'static int metadelay' to
	dtrace.ko:
	
	$dtrace -n 'BEGIN{trace(_boot_kernel_dtrace_ko`metadelay); exit(0)}'
	
	CPU     ID                    FUNCTION:NAME
	  0      1                           :BEGIN        30
	
	whereas the kernel value can be accessed with:
	
	$dtrace -n 'BEGIN{trace(_boot_kernel_kernel`metadelay); exit(0)}'
	
	CPU     ID                    FUNCTION:NAME
	  0      1                           :BEGIN        28

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_module.c#7 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_module.c#7 (text) ====

@@ -849,8 +849,19 @@
 	    "%s/%s/object", OBJFS_ROOT, name);
 #else
 	GElf_Phdr ph;
-	char *name = fname;
+	char name[MAXPATHLEN];
+	char *p;
 	int i = 0;
+
+	/*
+	 * Create a module name based on the full path name of the
+	 * kernel module, but with slashes and dots changed to be
+	 * underscores to suit the parser.
+	 */
+	(void) strlcpy(name, k_stat->pathname, sizeof(name));
+	for (p = name; *p != '\0'; p++)
+		if (*p == '/' || *p == '.')
+			*p = '_';
 	(void) strlcpy(fname, k_stat->pathname, sizeof(fname));
 #endif
 


More information about the p4-projects mailing list