xref: /onnv-gate/usr/src/lib/libdtrace/common/dt_provider.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_DT_PROVIDER_H
28*0Sstevel@tonic-gate #define	_DT_PROVIDER_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #include <dt_impl.h>
33*0Sstevel@tonic-gate #include <dt_ident.h>
34*0Sstevel@tonic-gate #include <dt_list.h>
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifdef	__cplusplus
37*0Sstevel@tonic-gate extern "C" {
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate typedef struct dt_provider {
41*0Sstevel@tonic-gate 	dt_list_t pv_list;		/* list forward/back pointers */
42*0Sstevel@tonic-gate 	struct dt_provider *pv_next;	/* pointer to next provider in hash */
43*0Sstevel@tonic-gate 	dtrace_providerdesc_t pv_desc;	/* provider name and attributes */
44*0Sstevel@tonic-gate 	dt_idhash_t *pv_probes;		/* probe defs (if user-declared) */
45*0Sstevel@tonic-gate 	dt_node_t *pv_nodes;		/* parse node allocation list */
46*0Sstevel@tonic-gate 	ulong_t pv_gen;			/* generation # that created me */
47*0Sstevel@tonic-gate 	dtrace_hdl_t *pv_hdl;		/* pointer to containing dtrace_hdl */
48*0Sstevel@tonic-gate 	uint_t pv_flags;		/* flags (see below) */
49*0Sstevel@tonic-gate } dt_provider_t;
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate #define	DT_PROVIDER_INTF	0x1	/* provider interface declaration */
52*0Sstevel@tonic-gate #define	DT_PROVIDER_IMPL	0x2	/* provider implementation is loaded */
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate typedef struct dt_probe_iter {
55*0Sstevel@tonic-gate 	dtrace_probedesc_t pit_desc;	/* description storage */
56*0Sstevel@tonic-gate 	dtrace_hdl_t *pit_hdl;		/* libdtrace handle */
57*0Sstevel@tonic-gate 	dt_provider_t *pit_pvp;		/* current provider */
58*0Sstevel@tonic-gate 	const char *pit_pat;		/* caller's name pattern (or NULL) */
59*0Sstevel@tonic-gate 	dtrace_probe_f *pit_func;	/* caller's function */
60*0Sstevel@tonic-gate 	void *pit_arg;			/* caller's argument */
61*0Sstevel@tonic-gate 	uint_t pit_matches;		/* number of matches */
62*0Sstevel@tonic-gate } dt_probe_iter_t;
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate typedef struct dt_probe_instance {
65*0Sstevel@tonic-gate 	char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */
66*0Sstevel@tonic-gate 	uint32_t *pi_offs;		/* offsets into the function */
67*0Sstevel@tonic-gate 	uint_t pi_noffs;		/* number of offsets */
68*0Sstevel@tonic-gate 	uint_t pi_maxoffs;		/* size of pi_offs allocation */
69*0Sstevel@tonic-gate 	struct dt_probe_instance *pi_next; /* next instance in the list */
70*0Sstevel@tonic-gate } dt_probe_instance_t;
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate typedef struct dt_probe {
73*0Sstevel@tonic-gate 	dt_provider_t *pr_pvp;		/* pointer to containing provider */
74*0Sstevel@tonic-gate 	dt_ident_t *pr_ident;		/* pointer to probe identifier */
75*0Sstevel@tonic-gate 	const char *pr_name;		/* pointer to name component */
76*0Sstevel@tonic-gate 	dt_node_t *pr_nargs;		/* native argument list */
77*0Sstevel@tonic-gate 	dt_node_t **pr_nargv;		/* native argument vector */
78*0Sstevel@tonic-gate 	uint_t pr_nargc;		/* native argument count */
79*0Sstevel@tonic-gate 	dt_node_t *pr_xargs;		/* translated argument list */
80*0Sstevel@tonic-gate 	dt_node_t **pr_xargv;		/* translated argument vector */
81*0Sstevel@tonic-gate 	uint_t pr_xargc;		/* translated argument count */
82*0Sstevel@tonic-gate 	uint8_t *pr_mapping;		/* translated argument mapping */
83*0Sstevel@tonic-gate 	dt_probe_instance_t *pr_inst;	/* list of functions and offsets */
84*0Sstevel@tonic-gate 	dtrace_typeinfo_t *pr_argv;	/* output argument types */
85*0Sstevel@tonic-gate 	int pr_argc;			/* output argument count */
86*0Sstevel@tonic-gate } dt_probe_t;
87*0Sstevel@tonic-gate 
88*0Sstevel@tonic-gate extern dt_provider_t *dt_provider_lookup(dtrace_hdl_t *, const char *);
89*0Sstevel@tonic-gate extern dt_provider_t *dt_provider_create(dtrace_hdl_t *, const char *);
90*0Sstevel@tonic-gate extern void dt_provider_destroy(dtrace_hdl_t *, dt_provider_t *);
91*0Sstevel@tonic-gate 
92*0Sstevel@tonic-gate extern dt_probe_t *dt_probe_create(dtrace_hdl_t *, dt_ident_t *,
93*0Sstevel@tonic-gate     dt_node_t *, uint_t, dt_node_t *, uint_t);
94*0Sstevel@tonic-gate 
95*0Sstevel@tonic-gate extern dt_probe_t *dt_probe_info(dtrace_hdl_t *,
96*0Sstevel@tonic-gate     const dtrace_probedesc_t *, dtrace_probeinfo_t *);
97*0Sstevel@tonic-gate 
98*0Sstevel@tonic-gate extern dt_probe_t *dt_probe_lookup(dt_provider_t *, const char *);
99*0Sstevel@tonic-gate extern void dt_probe_declare(dt_provider_t *, dt_probe_t *);
100*0Sstevel@tonic-gate extern void dt_probe_destroy(dt_probe_t *);
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate extern int dt_probe_define(dt_provider_t *, dt_probe_t *,
103*0Sstevel@tonic-gate     const char *, uint32_t);
104*0Sstevel@tonic-gate 
105*0Sstevel@tonic-gate #ifdef	__cplusplus
106*0Sstevel@tonic-gate }
107*0Sstevel@tonic-gate #endif
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate #endif	/* _DT_PROVIDER_H */
110