10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1710Sahl * Common Development and Distribution License (the "License"). 6*1710Sahl * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*1710Sahl 220Sstevel@tonic-gate /* 231239Sahl * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _DT_PROVIDER_H 280Sstevel@tonic-gate #define _DT_PROVIDER_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <dt_impl.h> 330Sstevel@tonic-gate #include <dt_ident.h> 340Sstevel@tonic-gate #include <dt_list.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate typedef struct dt_provider { 410Sstevel@tonic-gate dt_list_t pv_list; /* list forward/back pointers */ 420Sstevel@tonic-gate struct dt_provider *pv_next; /* pointer to next provider in hash */ 430Sstevel@tonic-gate dtrace_providerdesc_t pv_desc; /* provider name and attributes */ 440Sstevel@tonic-gate dt_idhash_t *pv_probes; /* probe defs (if user-declared) */ 450Sstevel@tonic-gate dt_node_t *pv_nodes; /* parse node allocation list */ 46265Smws ulong_t *pv_xrefs; /* translator reference bitmap */ 47265Smws ulong_t pv_xrmax; /* number of valid bits in pv_xrefs */ 480Sstevel@tonic-gate ulong_t pv_gen; /* generation # that created me */ 490Sstevel@tonic-gate dtrace_hdl_t *pv_hdl; /* pointer to containing dtrace_hdl */ 500Sstevel@tonic-gate uint_t pv_flags; /* flags (see below) */ 510Sstevel@tonic-gate } dt_provider_t; 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define DT_PROVIDER_INTF 0x1 /* provider interface declaration */ 540Sstevel@tonic-gate #define DT_PROVIDER_IMPL 0x2 /* provider implementation is loaded */ 550Sstevel@tonic-gate 560Sstevel@tonic-gate typedef struct dt_probe_iter { 570Sstevel@tonic-gate dtrace_probedesc_t pit_desc; /* description storage */ 580Sstevel@tonic-gate dtrace_hdl_t *pit_hdl; /* libdtrace handle */ 590Sstevel@tonic-gate dt_provider_t *pit_pvp; /* current provider */ 600Sstevel@tonic-gate const char *pit_pat; /* caller's name pattern (or NULL) */ 610Sstevel@tonic-gate dtrace_probe_f *pit_func; /* caller's function */ 620Sstevel@tonic-gate void *pit_arg; /* caller's argument */ 630Sstevel@tonic-gate uint_t pit_matches; /* number of matches */ 640Sstevel@tonic-gate } dt_probe_iter_t; 650Sstevel@tonic-gate 660Sstevel@tonic-gate typedef struct dt_probe_instance { 670Sstevel@tonic-gate char pi_fname[DTRACE_FUNCNAMELEN]; /* function name */ 681239Sahl char pi_rname[DTRACE_FUNCNAMELEN + 20]; /* mangled relocation name */ 690Sstevel@tonic-gate uint32_t *pi_offs; /* offsets into the function */ 70*1710Sahl uint32_t *pi_enoffs; /* is-enabled offsets */ 710Sstevel@tonic-gate uint_t pi_noffs; /* number of offsets */ 720Sstevel@tonic-gate uint_t pi_maxoffs; /* size of pi_offs allocation */ 73*1710Sahl uint_t pi_nenoffs; /* number of is-enabled offsets */ 74*1710Sahl uint_t pi_maxenoffs; /* size of pi_enoffs allocation */ 750Sstevel@tonic-gate struct dt_probe_instance *pi_next; /* next instance in the list */ 760Sstevel@tonic-gate } dt_probe_instance_t; 770Sstevel@tonic-gate 780Sstevel@tonic-gate typedef struct dt_probe { 790Sstevel@tonic-gate dt_provider_t *pr_pvp; /* pointer to containing provider */ 800Sstevel@tonic-gate dt_ident_t *pr_ident; /* pointer to probe identifier */ 810Sstevel@tonic-gate const char *pr_name; /* pointer to name component */ 820Sstevel@tonic-gate dt_node_t *pr_nargs; /* native argument list */ 830Sstevel@tonic-gate dt_node_t **pr_nargv; /* native argument vector */ 840Sstevel@tonic-gate uint_t pr_nargc; /* native argument count */ 850Sstevel@tonic-gate dt_node_t *pr_xargs; /* translated argument list */ 860Sstevel@tonic-gate dt_node_t **pr_xargv; /* translated argument vector */ 870Sstevel@tonic-gate uint_t pr_xargc; /* translated argument count */ 880Sstevel@tonic-gate uint8_t *pr_mapping; /* translated argument mapping */ 890Sstevel@tonic-gate dt_probe_instance_t *pr_inst; /* list of functions and offsets */ 900Sstevel@tonic-gate dtrace_typeinfo_t *pr_argv; /* output argument types */ 910Sstevel@tonic-gate int pr_argc; /* output argument count */ 920Sstevel@tonic-gate } dt_probe_t; 930Sstevel@tonic-gate 940Sstevel@tonic-gate extern dt_provider_t *dt_provider_lookup(dtrace_hdl_t *, const char *); 950Sstevel@tonic-gate extern dt_provider_t *dt_provider_create(dtrace_hdl_t *, const char *); 960Sstevel@tonic-gate extern void dt_provider_destroy(dtrace_hdl_t *, dt_provider_t *); 97265Smws extern int dt_provider_xref(dtrace_hdl_t *, dt_provider_t *, id_t); 980Sstevel@tonic-gate 99265Smws extern dt_probe_t *dt_probe_create(dtrace_hdl_t *, dt_ident_t *, int, 1000Sstevel@tonic-gate dt_node_t *, uint_t, dt_node_t *, uint_t); 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate extern dt_probe_t *dt_probe_info(dtrace_hdl_t *, 1030Sstevel@tonic-gate const dtrace_probedesc_t *, dtrace_probeinfo_t *); 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate extern dt_probe_t *dt_probe_lookup(dt_provider_t *, const char *); 1060Sstevel@tonic-gate extern void dt_probe_declare(dt_provider_t *, dt_probe_t *); 1070Sstevel@tonic-gate extern void dt_probe_destroy(dt_probe_t *); 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate extern int dt_probe_define(dt_provider_t *, dt_probe_t *, 110*1710Sahl const char *, const char *, uint32_t, int); 1110Sstevel@tonic-gate 112265Smws extern dt_node_t *dt_probe_tag(dt_probe_t *, uint_t, dt_node_t *); 113265Smws 1140Sstevel@tonic-gate #ifdef __cplusplus 1150Sstevel@tonic-gate } 1160Sstevel@tonic-gate #endif 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate #endif /* _DT_PROVIDER_H */ 119