Date: Sat, 29 Apr 2006 11:57:33 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 96358 for review Message-ID: <200604291157.k3TBvX5o088448@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=96358 Change 96358 by jb@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604291157.k3TBvX5o088448>