From owner-svn-src-all@FreeBSD.ORG Mon Jun 17 15:42:22 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 50F28BD4; Mon, 17 Jun 2013 15:42:22 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 28A001E80; Mon, 17 Jun 2013 15:42:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5HFgM3J038846; Mon, 17 Jun 2013 15:42:22 GMT (envelope-from gnn@svn.freebsd.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5HFgMSj038845; Mon, 17 Jun 2013 15:42:22 GMT (envelope-from gnn@svn.freebsd.org) Message-Id: <201306171542.r5HFgMSj038845@svn.freebsd.org> From: "George V. Neville-Neil" Date: Mon, 17 Jun 2013 15:42:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r251857 - stable/9/cddl/contrib/opensolaris/lib/libdtrace/common X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jun 2013 15:42:22 -0000 Author: gnn Date: Mon Jun 17 15:42:21 2013 New Revision: 251857 URL: http://svnweb.freebsd.org/changeset/base/251857 Log: MFC: 248848 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 Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Directory Properties: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Mon Jun 17 15:34:22 2013 (r251856) +++ stable/9/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c Mon Jun 17 15:42:21 2013 (r251857) @@ -241,6 +241,8 @@ dt_pragma_depends(const char *prname, dt 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 " \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) {