Date: Thu, 22 Jun 2006 05:21:25 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99796 for review Message-ID: <200606220521.k5M5LP6L007169@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606220521.k5M5LP6L007169>