From owner-p4-projects@FreeBSD.ORG Sat Apr 29 11:57:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5E8C416A405; Sat, 29 Apr 2006 11:57:34 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1FCE916A402 for ; Sat, 29 Apr 2006 11:57:34 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E1AEB43D48 for ; Sat, 29 Apr 2006 11:57:33 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3TBvXG0088451 for ; Sat, 29 Apr 2006 11:57:33 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3TBvX5o088448 for perforce@freebsd.org; Sat, 29 Apr 2006 11:57:33 GMT (envelope-from jb@freebsd.org) Date: Sat, 29 Apr 2006 11:57:33 GMT Message-Id: <200604291157.k3TBvX5o088448@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 96358 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2006 11:57:34 -0000 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