From owner-p4-projects@FreeBSD.ORG Thu Jun 22 05:38:32 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 AAE6016A54C; Thu, 22 Jun 2006 05:38:31 +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 7DF4816A536 for ; Thu, 22 Jun 2006 05:38:31 +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 2B0F24462B for ; Thu, 22 Jun 2006 05:21:26 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5M5LQxP007172 for ; Thu, 22 Jun 2006 05:21:26 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5M5LP6L007169 for perforce@freebsd.org; Thu, 22 Jun 2006 05:21:25 GMT (envelope-from jb@freebsd.org) Date: Thu, 22 Jun 2006 05:21:25 GMT Message-Id: <200606220521.k5M5LP6L007169@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 99796 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: Thu, 22 Jun 2006 05:38:32 -0000 http://perforce.freebsd.org/chv.cgi?CH=99796 Change 99796 by jb@jb_freebsd2 on 2006/06/22 05:20:42 FreeBSD doesn't have driver configuration files like Solaris does. Write the anonymous DOF data to '/boot/dtrace.dof' in the format of a kernel environment string with each DOF byte represented as a two hexadecimal ASCII character. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/dtrace.c#6 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/cmd/dtrace/dtrace.c#6 (text) ==== @@ -100,6 +100,7 @@ static const char *g_ofile = NULL; static FILE *g_ofp; static dtrace_hdl_t *g_dtp; +#if defined(sun) static char *g_etcfile = "/etc/system"; static const char *g_etcbegin = "* vvvv Added by DTrace"; static const char *g_etcend = "* ^^^^ Added by DTrace"; @@ -114,6 +115,7 @@ "* chapter of the Solaris Dynamic Tracing Guide for details.", "*", NULL }; +#endif static int usage(FILE *fp) @@ -372,6 +374,7 @@ free(buf); } +#if defined(sun) static void etcsystem_prune(void) { @@ -482,6 +485,7 @@ error("added forceload directives to %s\n", g_ofile); } +#endif static void print_probe_info(const dtrace_probeinfo_t *p) @@ -611,12 +615,26 @@ p = (uchar_t *)dof; q = p + dof->dofh_loadsz; +#if defined(sun) oprintf("dof-data-%d=0x%x", n, *p++); while (p < q) oprintf(",0x%x", *p++); oprintf(";\n"); +#else + /* + * On FreeBSD, the DOF data is handled as a kernel environment (kenv) + * string. We use two hex characters per DOF byte. + */ + oprintf("dof-data-%d=%02x", n, *p++); + + while (p < q) + oprintf("%02x", *p++); + + oprintf("\n"); +#endif + dtrace_dof_destroy(g_dtp, dof); } @@ -1566,10 +1584,21 @@ case DMODE_ANON: if (g_ofile == NULL) +#if defined(sun) g_ofile = "/kernel/drv/dtrace.conf"; +#else + /* + * On FreeBSD, anonymous DOF data is written to + * the DTrace DOF file that the boot loader will + * read if booting with the DTrace option. + */ + g_ofile = "/boot/dtrace.dof"; +#endif dof_prune(g_ofile); /* strip out any old DOF directives */ +#if defined(sun) etcsystem_prune(); /* string out any forceload directives */ +#endif if (g_cmdc == 0) { dtrace_close(g_dtp); @@ -1600,8 +1629,10 @@ * that itself contains a #pragma D option quiet. */ error("saved anonymous enabling in %s\n", g_ofile); +#if defined(sun) etcsystem_add(); error("run update_drv(1M) or reboot to enable changes\n"); +#endif dtrace_close(g_dtp); return (g_status);