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