PERFORCE change 99101 for review

John Birrell jb at FreeBSD.org
Tue Jun 13 00:54:11 UTC 2006


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

Change 99101 by jb at jb_freebsd2 on 2006/06/13 00:51:08

	Use Sun's standard module naming.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_module.c#9 edit
.. //depot/projects/dtrace/src/contrib/opensolaris/lib/libdtrace/common/dt_open.c#13 edit

Differences ...

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

@@ -846,18 +846,9 @@
 #else
 	GElf_Phdr ph;
 	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(name, k_stat->name, sizeof(name));
 	(void) strlcpy(fname, k_stat->pathname, sizeof(fname));
 #endif
 

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

@@ -119,7 +119,7 @@
 };
 
 /*
- * Global varaiables that are formatted on FreeBSD based on the kernel file name.
+ * Global variables that are formatted on FreeBSD based on the kernel file name.
  */
 #if !defined(sun)
 static char	curthread_str[MAXPATHLEN];
@@ -1098,25 +1098,23 @@
 #if !defined(sun)
 	{
 	char bootfile[MAXPATHLEN];
+	char *p;
 	int i;
 	size_t len = sizeof(bootfile);
 
 	/* This call shouldn't fail, but use a default just in case. */
 	if (sysctlbyname("kern.bootfile", bootfile, &len, NULL, 0) != 0)
-		strlcpy(bootfile, "_boot_kernel_kernel", sizeof(bootfile));
+		strlcpy(bootfile, "kernel", sizeof(bootfile));
 
-	/*
-	 * Convert the kernel file name to a DTrace module name because DTrace
-	 * doesn't like slashes in module names.
-	 */
-	for (i = 0; i < len; i++)
-		if (bootfile[i] == '/')
-			bootfile[i] = '_';
+	if ((p = strrchr(bootfile, '/')) != NULL)
+		p++;
+	else
+		p = bootfile;
 
 	/*
 	 * Format the global variables based on the kernel module name.
 	 */
-	snprintf(curthread_str, sizeof(curthread_str), "%s`struct thread *",bootfile);
+	snprintf(curthread_str, sizeof(curthread_str), "%s`struct thread *",p);
 	}
 #endif
 


More information about the p4-projects mailing list