Date: Tue, 13 Jun 2006 00:51:50 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99101 for review Message-ID: <200606130051.k5D0poZm052861@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99101 Change 99101 by jb@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606130051.k5D0poZm052861>