summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authorgnn <gnn@FreeBSD.org>2013-03-28 20:31:03 +0000
committergnn <gnn@FreeBSD.org>2013-03-28 20:31:03 +0000
commit9e7e2d6285a0444ccbaf2b33f9a8467080cd6268 (patch)
treeb84f7cb26fecfeeb8aed570392f4196a359806c4 /cddl
parentd955ec99d7b175fef1bcac90e3c6e49ecad920e6 (diff)
downloadFreeBSD-src-9e7e2d6285a0444ccbaf2b33f9a8467080cd6268.zip
FreeBSD-src-9e7e2d6285a0444ccbaf2b33f9a8467080cd6268.tar.gz
Commit a patch that fixes a problem in the #pragma statement when searching
for and loading dependent modules. This addresses a bug seen with io.d where it was being doubly included. PR: 171678 Submitted by: Mark Johnston MFC after: 2 weeks
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
index 00578f4..760c2f6 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
@@ -241,6 +241,8 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
int found;
dt_lib_depend_t *dld;
char lib[MAXPATHLEN];
+ size_t plen;
+ char *provs, *cpy, *tok;
if (cnp == NULL || nnp == NULL ||
cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) {
@@ -248,9 +250,31 @@ dt_pragma_depends(const char *prname, dt_node_t *cnp)
"<class> <name>\n", prname);
}
- if (strcmp(cnp->dn_string, "provider") == 0)
- found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
- else if (strcmp(cnp->dn_string, "module") == 0) {
+ if (strcmp(cnp->dn_string, "provider") == 0) {
+ /*
+ * First try to get the provider list using the
+ * debug.dtrace.providers sysctl, since that'll work even if
+ * we're not running as root.
+ */
+ provs = NULL;
+ if (sysctlbyname("debug.dtrace.providers", NULL, &plen, NULL, 0) ||
+ ((provs = dt_alloc(dtp, plen)) == NULL) ||
+ sysctlbyname("debug.dtrace.providers", provs, &plen, NULL, 0))
+ found = dt_provider_lookup(dtp, nnp->dn_string) != NULL;
+ else {
+ found = B_FALSE;
+ for (cpy = provs; (tok = strsep(&cpy, " ")) != NULL; )
+ if (strcmp(tok, nnp->dn_string) == 0) {
+ found = B_TRUE;
+ break;
+ }
+ if (found == B_FALSE)
+ found = dt_provider_lookup(dtp,
+ nnp->dn_string) != NULL;
+ }
+ if (provs != NULL)
+ dt_free(dtp, provs);
+ } else if (strcmp(cnp->dn_string, "module") == 0) {
dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string);
found = mp != NULL && dt_module_getctf(dtp, mp) != NULL;
} else if (strcmp(cnp->dn_string, "library") == 0) {
OpenPOWER on IntegriCloud