summaryrefslogtreecommitdiff
path: root/usr/src/lib/libdtrace/common/dt_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libdtrace/common/dt_program.c')
-rw-r--r--usr/src/lib/libdtrace/common/dt_program.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/usr/src/lib/libdtrace/common/dt_program.c b/usr/src/lib/libdtrace/common/dt_program.c
index e0d3ada107..d751c4817b 100644
--- a/usr/src/lib/libdtrace/common/dt_program.c
+++ b/usr/src/lib/libdtrace/common/dt_program.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -50,6 +49,13 @@ dt_program_create(dtrace_hdl_t *dtp)
else
(void) dt_set_errno(dtp, EDT_NOMEM);
+ /*
+ * By default, programs start with DOF version 1 so that output files
+ * containing DOF are backward compatible. If a program requires new
+ * DOF features, the version is increased as needed.
+ */
+ pgp->dp_dofversion = DOF_VERSION_1;
+
return (pgp);
}
@@ -425,6 +431,10 @@ dt_header_decl(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
if (fprintf(infop->dthi_out, ");\n") < 0)
return (dt_set_errno(dtp, errno));
+ if (fprintf(infop->dthi_out, "extern int "
+ "__dtraceenabled_%s___%s(void);\n", infop->dthi_pfname, fname) < 0)
+ return (dt_set_errno(dtp, errno));
+
return (0);
}
@@ -481,6 +491,14 @@ dt_header_probe(dt_idhash_t *dhp, dt_ident_t *idp, void *data)
if (fprintf(infop->dthi_out, ")\n") < 0)
return (dt_set_errno(dtp, errno));
+ if (fprintf(infop->dthi_out, "#define\t%s_%s_ENABLED() \\\n",
+ infop->dthi_pmname, mname) < 0)
+ return (dt_set_errno(dtp, errno));
+
+ if (fprintf(infop->dthi_out, "\t__dtraceenabled_%s___%s()\n",
+ infop->dthi_pfname, fname) < 0)
+ return (dt_set_errno(dtp, errno));
+
return (0);
}