dt_pragma.c (239536) | dt_pragma.c (251857) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 227 unchanged lines hidden (view full) --- 236static void 237dt_pragma_depends(const char *prname, dt_node_t *cnp) 238{ 239 dtrace_hdl_t *dtp = yypcb->pcb_hdl; 240 dt_node_t *nnp = cnp ? cnp->dn_list : NULL; 241 int found; 242 dt_lib_depend_t *dld; 243 char lib[MAXPATHLEN]; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 227 unchanged lines hidden (view full) --- 236static void 237dt_pragma_depends(const char *prname, dt_node_t *cnp) 238{ 239 dtrace_hdl_t *dtp = yypcb->pcb_hdl; 240 dt_node_t *nnp = cnp ? cnp->dn_list : NULL; 241 int found; 242 dt_lib_depend_t *dld; 243 char lib[MAXPATHLEN]; |
244 size_t plen; 245 char *provs, *cpy, *tok; |
|
244 245 if (cnp == NULL || nnp == NULL || 246 cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) { 247 xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s " 248 "<class> <name>\n", prname); 249 } 250 | 246 247 if (cnp == NULL || nnp == NULL || 248 cnp->dn_kind != DT_NODE_IDENT || nnp->dn_kind != DT_NODE_IDENT) { 249 xyerror(D_PRAGMA_MALFORM, "malformed #pragma %s " 250 "<class> <name>\n", prname); 251 } 252 |
251 if (strcmp(cnp->dn_string, "provider") == 0) 252 found = dt_provider_lookup(dtp, nnp->dn_string) != NULL; 253 else if (strcmp(cnp->dn_string, "module") == 0) { | 253 if (strcmp(cnp->dn_string, "provider") == 0) { 254 /* 255 * First try to get the provider list using the 256 * debug.dtrace.providers sysctl, since that'll work even if 257 * we're not running as root. 258 */ 259 provs = NULL; 260 if (sysctlbyname("debug.dtrace.providers", NULL, &plen, NULL, 0) || 261 ((provs = dt_alloc(dtp, plen)) == NULL) || 262 sysctlbyname("debug.dtrace.providers", provs, &plen, NULL, 0)) 263 found = dt_provider_lookup(dtp, nnp->dn_string) != NULL; 264 else { 265 found = B_FALSE; 266 for (cpy = provs; (tok = strsep(&cpy, " ")) != NULL; ) 267 if (strcmp(tok, nnp->dn_string) == 0) { 268 found = B_TRUE; 269 break; 270 } 271 if (found == B_FALSE) 272 found = dt_provider_lookup(dtp, 273 nnp->dn_string) != NULL; 274 } 275 if (provs != NULL) 276 dt_free(dtp, provs); 277 } else if (strcmp(cnp->dn_string, "module") == 0) { |
254 dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string); 255 found = mp != NULL && dt_module_getctf(dtp, mp) != NULL; 256 } else if (strcmp(cnp->dn_string, "library") == 0) { 257 if (yypcb->pcb_cflags & DTRACE_C_CTL) { 258 assert(dtp->dt_filetag != NULL); 259 260 dt_pragma_depends_finddep(dtp, nnp->dn_string, lib, 261 sizeof (lib)); --- 270 unchanged lines hidden --- | 278 dt_module_t *mp = dt_module_lookup_by_name(dtp, nnp->dn_string); 279 found = mp != NULL && dt_module_getctf(dtp, mp) != NULL; 280 } else if (strcmp(cnp->dn_string, "library") == 0) { 281 if (yypcb->pcb_cflags & DTRACE_C_CTL) { 282 assert(dtp->dt_filetag != NULL); 283 284 dt_pragma_depends_finddep(dtp, nnp->dn_string, lib, 285 sizeof (lib)); --- 270 unchanged lines hidden --- |