Deleted Added
full compact
dt_provider.c (256281) dt_provider.c (268578)
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

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
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

--- 9 unchanged lines hidden (view full) ---

18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26/*
27 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
28 */
26
29
27#pragma ident "%Z%%M% %I% %E% SMI"
28
29#include <sys/types.h>
30#if defined(sun)
31#include <sys/sysmacros.h>
32#endif
33
34#include <assert.h>
35#include <limits.h>
36#include <strings.h>
37#include <stdlib.h>
38#if defined(sun)
39#include <alloca.h>
40#endif
41#include <unistd.h>
42#include <errno.h>
43
44#include <dt_provider.h>
45#include <dt_module.h>
46#include <dt_string.h>
47#include <dt_list.h>
30#include <sys/types.h>
31#if defined(sun)
32#include <sys/sysmacros.h>
33#endif
34
35#include <assert.h>
36#include <limits.h>
37#include <strings.h>
38#include <stdlib.h>
39#if defined(sun)
40#include <alloca.h>
41#endif
42#include <unistd.h>
43#include <errno.h>
44
45#include <dt_provider.h>
46#include <dt_module.h>
47#include <dt_string.h>
48#include <dt_list.h>
49#include <dt_pid.h>
50#include <dtrace.h>
48
49static dt_provider_t *
50dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h)
51{
52 dt_list_append(&dtp->dt_provlist, pvp);
53
54 pvp->pv_next = dtp->dt_provs[h];
55 dtp->dt_provs[h] = pvp;

--- 212 unchanged lines hidden (view full) ---

268
269 nc = MAX(nc, adp->dtargd_mapping);
270 }
271
272 xc = i;
273 nc++;
274
275 /*
51
52static dt_provider_t *
53dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h)
54{
55 dt_list_append(&dtp->dt_provlist, pvp);
56
57 pvp->pv_next = dtp->dt_provs[h];
58 dtp->dt_provs[h] = pvp;

--- 212 unchanged lines hidden (view full) ---

271
272 nc = MAX(nc, adp->dtargd_mapping);
273 }
274
275 xc = i;
276 nc++;
277
278 /*
279 * The pid provider believes in giving the kernel a break. No reason to
280 * give the kernel all the ctf containers that we're keeping ourselves
281 * just to get it back from it. So if we're coming from a pid provider
282 * probe and the kernel gave us no argument information we'll get some
283 * here. If for some crazy reason the kernel knows about our userland
284 * types then we just ignore this.
285 */
286 if (xc == 0 && nc == 0 &&
287 strncmp(pvp->pv_desc.dtvd_name, "pid", 3) == 0) {
288 nc = adc;
289 dt_pid_get_types(dtp, pdp, adv, &nc);
290 xc = nc;
291 }
292
293 /*
276 * Now that we have discovered the number of native and translated
277 * arguments from the argument descriptions, allocate a new probe ident
278 * and corresponding dt_probe_t and hash it into the provider.
279 */
280 xargs = dt_probe_alloc_args(pvp, xc);
281 nargs = dt_probe_alloc_args(pvp, nc);
282
283 if ((xc != 0 && xargs == NULL) || (nc != 0 && nargs == NULL))

--- 29 unchanged lines hidden (view full) ---

313 pvp->pv_desc.dtvd_name, name, i + 1,
314 dtrace_errmsg(dtp, dtrace_errno(dtp)));
315
316 dtt.dtt_object = NULL;
317 dtt.dtt_ctfp = NULL;
318 dtt.dtt_type = CTF_ERR;
319 } else {
320 dt_node_type_assign(prp->pr_nargv[adp->dtargd_mapping],
294 * Now that we have discovered the number of native and translated
295 * arguments from the argument descriptions, allocate a new probe ident
296 * and corresponding dt_probe_t and hash it into the provider.
297 */
298 xargs = dt_probe_alloc_args(pvp, xc);
299 nargs = dt_probe_alloc_args(pvp, nc);
300
301 if ((xc != 0 && xargs == NULL) || (nc != 0 && nargs == NULL))

--- 29 unchanged lines hidden (view full) ---

331 pvp->pv_desc.dtvd_name, name, i + 1,
332 dtrace_errmsg(dtp, dtrace_errno(dtp)));
333
334 dtt.dtt_object = NULL;
335 dtt.dtt_ctfp = NULL;
336 dtt.dtt_type = CTF_ERR;
337 } else {
338 dt_node_type_assign(prp->pr_nargv[adp->dtargd_mapping],
321 dtt.dtt_ctfp, dtt.dtt_type);
339 dtt.dtt_ctfp, dtt.dtt_type,
340 dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
322 }
323
324 if (dtt.dtt_type != CTF_ERR && (adp->dtargd_xlate[0] == '\0' ||
325 strcmp(adp->dtargd_native, adp->dtargd_xlate) == 0)) {
326 dt_node_type_propagate(prp->pr_nargv[
327 adp->dtargd_mapping], prp->pr_xargv[i]);
328 } else if (dtrace_type_strcompile(dtp,
329 adp->dtargd_xlate, &dtt) != 0) {
330 dt_dprintf("failed to resolve output type %s "
331 "for %s:%s arg #%d: %s\n", adp->dtargd_xlate,
332 pvp->pv_desc.dtvd_name, name, i + 1,
333 dtrace_errmsg(dtp, dtrace_errno(dtp)));
334
335 dtt.dtt_object = NULL;
336 dtt.dtt_ctfp = NULL;
337 dtt.dtt_type = CTF_ERR;
338 } else {
339 dt_node_type_assign(prp->pr_xargv[i],
341 }
342
343 if (dtt.dtt_type != CTF_ERR && (adp->dtargd_xlate[0] == '\0' ||
344 strcmp(adp->dtargd_native, adp->dtargd_xlate) == 0)) {
345 dt_node_type_propagate(prp->pr_nargv[
346 adp->dtargd_mapping], prp->pr_xargv[i]);
347 } else if (dtrace_type_strcompile(dtp,
348 adp->dtargd_xlate, &dtt) != 0) {
349 dt_dprintf("failed to resolve output type %s "
350 "for %s:%s arg #%d: %s\n", adp->dtargd_xlate,
351 pvp->pv_desc.dtvd_name, name, i + 1,
352 dtrace_errmsg(dtp, dtrace_errno(dtp)));
353
354 dtt.dtt_object = NULL;
355 dtt.dtt_ctfp = NULL;
356 dtt.dtt_type = CTF_ERR;
357 } else {
358 dt_node_type_assign(prp->pr_xargv[i],
340 dtt.dtt_ctfp, dtt.dtt_type);
359 dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
341 }
342
343 prp->pr_mapping[i] = adp->dtargd_mapping;
344 prp->pr_argv[i] = dtt;
345 }
346
347 return (prp);
348}

--- 284 unchanged lines hidden (view full) ---

633 xyerror(D_UNKNOWN, "cannot define type %s: %s\n",
634 tag, ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
635 }
636 }
637
638 bzero(dnp, sizeof (dt_node_t));
639 dnp->dn_kind = DT_NODE_TYPE;
640
360 }
361
362 prp->pr_mapping[i] = adp->dtargd_mapping;
363 prp->pr_argv[i] = dtt;
364 }
365
366 return (prp);
367}

--- 284 unchanged lines hidden (view full) ---

652 xyerror(D_UNKNOWN, "cannot define type %s: %s\n",
653 tag, ctf_errmsg(ctf_errno(dtt.dtt_ctfp)));
654 }
655 }
656
657 bzero(dnp, sizeof (dt_node_t));
658 dnp->dn_kind = DT_NODE_TYPE;
659
641 dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
660 dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
642 dt_node_attr_assign(dnp, _dtrace_defattr);
643
644 return (dnp);
645}
646
647/*ARGSUSED*/
648static int
649dt_probe_desc(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)

--- 234 unchanged lines hidden ---
661 dt_node_attr_assign(dnp, _dtrace_defattr);
662
663 return (dnp);
664}
665
666/*ARGSUSED*/
667static int
668dt_probe_desc(dtrace_hdl_t *dtp, const dtrace_probedesc_t *pdp, void *arg)

--- 234 unchanged lines hidden ---