VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dtrace.h@ 53654

Last change on this file since 53654 was 53653, checked in by vboxsync, 10 years ago

VBoxDTrace: libdtrace porting in progres... (r23)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.4 KB
Line 
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 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _DTRACE_H
28#define _DTRACE_H
29
30#ifndef VBOX
31#pragma ident "%Z%%M% %I% %E% SMI"
32
33#include <sys/dtrace.h>
34#include <stdarg.h>
35#include <stdio.h>
36#include <gelf.h>
37#else /* VBOX */
38# include <sys/dtrace.h>
39# include <stdio.h>
40#endif /* VBOX */
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 * DTrace Dynamic Tracing Software: Library Interfaces
48 *
49 * Note: The contents of this file are private to the implementation of the
50 * Solaris system and DTrace subsystem and are subject to change at any time
51 * without notice. Applications and drivers using these interfaces will fail
52 * to run on future releases. These interfaces should not be used for any
53 * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB).
54 * Please refer to the "Solaris Dynamic Tracing Guide" for more information.
55 */
56
57#define DTRACE_VERSION 3 /* library ABI interface version */
58
59struct ps_prochandle;
60typedef struct dtrace_hdl dtrace_hdl_t;
61typedef struct dtrace_prog dtrace_prog_t;
62typedef struct dtrace_vector dtrace_vector_t;
63typedef struct dtrace_aggdata dtrace_aggdata_t;
64
65#define DTRACE_O_NODEV 0x01 /* do not open dtrace(7D) device */
66#define DTRACE_O_NOSYS 0x02 /* do not load /system/object modules */
67#define DTRACE_O_LP64 0x04 /* force D compiler to be LP64 */
68#define DTRACE_O_ILP32 0x08 /* force D compiler to be ILP32 */
69#define DTRACE_O_MASK 0x0f /* mask of valid flags to dtrace_open */
70
71extern dtrace_hdl_t *dtrace_open(int, int, int *);
72extern dtrace_hdl_t *dtrace_vopen(int, int, int *,
73 const dtrace_vector_t *, void *);
74
75extern int dtrace_go(dtrace_hdl_t *);
76extern int dtrace_stop(dtrace_hdl_t *);
77extern void dtrace_sleep(dtrace_hdl_t *);
78extern void dtrace_close(dtrace_hdl_t *);
79
80extern int dtrace_errno(dtrace_hdl_t *);
81extern const char *dtrace_errmsg(dtrace_hdl_t *, int);
82extern const char *dtrace_faultstr(dtrace_hdl_t *, int);
83extern const char *dtrace_subrstr(dtrace_hdl_t *, int);
84
85extern int dtrace_setopt(dtrace_hdl_t *, const char *, const char *);
86extern int dtrace_getopt(dtrace_hdl_t *, const char *, dtrace_optval_t *);
87
88extern void dtrace_update(dtrace_hdl_t *);
89extern int dtrace_ctlfd(dtrace_hdl_t *);
90
91/*
92 * DTrace Program Interface
93 *
94 * DTrace programs can be created by compiling ASCII text files containing
95 * D programs or by compiling in-memory C strings that specify a D program.
96 * Once created, callers can examine the list of program statements and
97 * enable the probes and actions described by these statements.
98 */
99
100typedef struct dtrace_proginfo {
101 dtrace_attribute_t dpi_descattr; /* minimum probedesc attributes */
102 dtrace_attribute_t dpi_stmtattr; /* minimum statement attributes */
103 uint_t dpi_aggregates; /* number of aggregates specified in program */
104 uint_t dpi_recgens; /* number of record generating probes in prog */
105 uint_t dpi_matches; /* number of probes matched by program */
106 uint_t dpi_speculations; /* number of speculations specified in prog */
107} dtrace_proginfo_t;
108
109#define DTRACE_C_DIFV 0x0001 /* DIF verbose mode: show each compiled DIFO */
110#define DTRACE_C_EMPTY 0x0002 /* Permit compilation of empty D source files */
111#define DTRACE_C_ZDEFS 0x0004 /* Permit probe defs that match zero probes */
112#define DTRACE_C_EATTR 0x0008 /* Error if program attributes less than min */
113#define DTRACE_C_CPP 0x0010 /* Preprocess input file with cpp(1) utility */
114#define DTRACE_C_KNODEF 0x0020 /* Permit unresolved kernel symbols in DIFO */
115#define DTRACE_C_UNODEF 0x0040 /* Permit unresolved user symbols in DIFO */
116#define DTRACE_C_PSPEC 0x0080 /* Intepret ambiguous specifiers as probes */
117#define DTRACE_C_ETAGS 0x0100 /* Prefix error messages with error tags */
118#define DTRACE_C_ARGREF 0x0200 /* Do not require all macro args to be used */
119#define DTRACE_C_DEFARG 0x0800 /* Use 0/"" as value for unspecified args */
120#define DTRACE_C_NOLIBS 0x1000 /* Do not process D system libraries */
121#define DTRACE_C_CTL 0x2000 /* Only process control directives */
122#define DTRACE_C_MASK 0x3bff /* mask of all valid flags to dtrace_*compile */
123
124extern dtrace_prog_t *dtrace_program_strcompile(dtrace_hdl_t *,
125 const char *, dtrace_probespec_t, uint_t, int, char *const []);
126
127extern dtrace_prog_t *dtrace_program_fcompile(dtrace_hdl_t *,
128 FILE *, uint_t, int, char *const []);
129
130extern int dtrace_program_exec(dtrace_hdl_t *, dtrace_prog_t *,
131 dtrace_proginfo_t *);
132extern void dtrace_program_info(dtrace_hdl_t *, dtrace_prog_t *,
133 dtrace_proginfo_t *);
134
135#define DTRACE_D_STRIP 0x01 /* strip non-loadable sections from program */
136#define DTRACE_D_PROBES 0x02 /* include provider and probe definitions */
137#define DTRACE_D_MASK 0x03 /* mask of valid flags to dtrace_dof_create */
138
139extern int dtrace_program_link(dtrace_hdl_t *, dtrace_prog_t *,
140 uint_t, const char *, int, char *const []);
141
142extern int dtrace_program_header(dtrace_hdl_t *, FILE *, const char *);
143
144extern void *dtrace_dof_create(dtrace_hdl_t *, dtrace_prog_t *, uint_t);
145extern void dtrace_dof_destroy(dtrace_hdl_t *, void *);
146
147extern void *dtrace_getopt_dof(dtrace_hdl_t *);
148extern void *dtrace_geterr_dof(dtrace_hdl_t *);
149
150typedef struct dtrace_stmtdesc {
151 dtrace_ecbdesc_t *dtsd_ecbdesc; /* ECB description */
152 dtrace_actdesc_t *dtsd_action; /* action list */
153 dtrace_actdesc_t *dtsd_action_last; /* last action in action list */
154 void *dtsd_aggdata; /* aggregation data */
155 void *dtsd_fmtdata; /* type-specific output data */
156 void (*dtsd_callback)(); /* callback function for EPID */
157 void *dtsd_data; /* callback data pointer */
158 dtrace_attribute_t dtsd_descattr; /* probedesc attributes */
159 dtrace_attribute_t dtsd_stmtattr; /* statement attributes */
160} dtrace_stmtdesc_t;
161
162typedef int dtrace_stmt_f(dtrace_hdl_t *, dtrace_prog_t *,
163 dtrace_stmtdesc_t *, void *);
164
165extern dtrace_stmtdesc_t *dtrace_stmt_create(dtrace_hdl_t *,
166 dtrace_ecbdesc_t *);
167extern dtrace_actdesc_t *dtrace_stmt_action(dtrace_hdl_t *,
168 dtrace_stmtdesc_t *);
169extern int dtrace_stmt_add(dtrace_hdl_t *, dtrace_prog_t *,
170 dtrace_stmtdesc_t *);
171extern int dtrace_stmt_iter(dtrace_hdl_t *, dtrace_prog_t *,
172 dtrace_stmt_f *, void *);
173extern void dtrace_stmt_destroy(dtrace_hdl_t *, dtrace_stmtdesc_t *);
174
175/*
176 * DTrace Data Consumption Interface
177 */
178typedef enum {
179 DTRACEFLOW_ENTRY,
180 DTRACEFLOW_RETURN,
181 DTRACEFLOW_NONE
182} dtrace_flowkind_t;
183
184#define DTRACE_CONSUME_ERROR -1 /* error while processing */
185#define DTRACE_CONSUME_THIS 0 /* consume this probe/record */
186#define DTRACE_CONSUME_NEXT 1 /* advance to next probe/rec */
187#define DTRACE_CONSUME_ABORT 2 /* abort consumption */
188
189typedef struct dtrace_probedata {
190 dtrace_hdl_t *dtpda_handle; /* handle to DTrace library */
191 dtrace_eprobedesc_t *dtpda_edesc; /* enabled probe description */
192 dtrace_probedesc_t *dtpda_pdesc; /* probe description */
193 processorid_t dtpda_cpu; /* CPU for data */
194 caddr_t dtpda_data; /* pointer to raw data */
195 dtrace_flowkind_t dtpda_flow; /* flow kind */
196 const char *dtpda_prefix; /* recommended flow prefix */
197 int dtpda_indent; /* recommended flow indent */
198} dtrace_probedata_t;
199
200typedef int dtrace_consume_probe_f(const dtrace_probedata_t *, void *);
201typedef int dtrace_consume_rec_f(const dtrace_probedata_t *,
202 const dtrace_recdesc_t *, void *);
203
204extern int dtrace_consume(dtrace_hdl_t *, FILE *,
205 dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *);
206
207#define DTRACE_STATUS_NONE 0 /* no status; not yet time */
208#define DTRACE_STATUS_OKAY 1 /* status okay */
209#define DTRACE_STATUS_EXITED 2 /* exit() was called; tracing stopped */
210#define DTRACE_STATUS_FILLED 3 /* fill buffer filled; tracing stoped */
211#define DTRACE_STATUS_STOPPED 4 /* tracing already stopped */
212
213extern int dtrace_status(dtrace_hdl_t *);
214
215/*
216 * DTrace Formatted Output Interfaces
217 *
218 * To format output associated with a given dtrace_stmtdesc, the caller can
219 * invoke one of the following functions, passing the opaque dtsd_fmtdata and a
220 * list of record descriptions. These functions return either -1 to indicate
221 * an error, or a positive integer indicating the number of records consumed.
222 * For anonymous enablings, the consumer can use the dtrd_format member of
223 * the record description to obtain a format description. The dtfd_string
224 * member of the format description may be passed to dtrace_print{fa}_create()
225 * to create the opaque format data.
226 */
227extern void *dtrace_printf_create(dtrace_hdl_t *, const char *);
228extern void *dtrace_printa_create(dtrace_hdl_t *, const char *);
229extern size_t dtrace_printf_format(dtrace_hdl_t *, void *, char *, size_t);
230
231extern int dtrace_fprintf(dtrace_hdl_t *, FILE *, void *,
232 const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
233 const void *, size_t);
234
235extern int dtrace_fprinta(dtrace_hdl_t *, FILE *, void *,
236 const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
237 const void *, size_t);
238
239extern int dtrace_system(dtrace_hdl_t *, FILE *, void *,
240 const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
241 const void *, size_t);
242
243extern int dtrace_freopen(dtrace_hdl_t *, FILE *, void *,
244 const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t,
245 const void *, size_t);
246
247/*
248 * DTrace Work Interface
249 */
250typedef enum {
251 DTRACE_WORKSTATUS_ERROR = -1,
252 DTRACE_WORKSTATUS_OKAY,
253 DTRACE_WORKSTATUS_DONE
254} dtrace_workstatus_t;
255
256extern dtrace_workstatus_t dtrace_work(dtrace_hdl_t *, FILE *,
257 dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *);
258
259/*
260 * DTrace Handler Interface
261 */
262#define DTRACE_HANDLE_ABORT -1 /* abort current operation */
263#define DTRACE_HANDLE_OK 0 /* handled okay; continue */
264
265typedef struct dtrace_errdata {
266 dtrace_hdl_t *dteda_handle; /* handle to DTrace library */
267 dtrace_eprobedesc_t *dteda_edesc; /* enabled probe inducing err */
268 dtrace_probedesc_t *dteda_pdesc; /* probe inducing error */
269 processorid_t dteda_cpu; /* CPU of error */
270 int dteda_action; /* action inducing error */
271 int dteda_offset; /* offset in DIFO of error */
272 int dteda_fault; /* specific fault */
273 uint64_t dteda_addr; /* address of fault, if any */
274 const char *dteda_msg; /* preconstructed message */
275} dtrace_errdata_t;
276
277typedef int dtrace_handle_err_f(const dtrace_errdata_t *, void *);
278extern int dtrace_handle_err(dtrace_hdl_t *, dtrace_handle_err_f *, void *);
279
280typedef enum {
281 DTRACEDROP_PRINCIPAL, /* drop to principal buffer */
282 DTRACEDROP_AGGREGATION, /* drop to aggregation buffer */
283 DTRACEDROP_DYNAMIC, /* dynamic drop */
284 DTRACEDROP_DYNRINSE, /* dyn drop due to rinsing */
285 DTRACEDROP_DYNDIRTY, /* dyn drop due to dirty */
286 DTRACEDROP_SPEC, /* speculative drop */
287 DTRACEDROP_SPECBUSY, /* spec drop due to busy */
288 DTRACEDROP_SPECUNAVAIL, /* spec drop due to unavail */
289 DTRACEDROP_STKSTROVERFLOW, /* stack string tab overflow */
290 DTRACEDROP_DBLERROR /* error in ERROR probe */
291} dtrace_dropkind_t;
292
293typedef struct dtrace_dropdata {
294 dtrace_hdl_t *dtdda_handle; /* handle to DTrace library */
295 processorid_t dtdda_cpu; /* CPU, if any */
296 dtrace_dropkind_t dtdda_kind; /* kind of drop */
297 uint64_t dtdda_drops; /* number of drops */
298 uint64_t dtdda_total; /* total drops */
299 const char *dtdda_msg; /* preconstructed message */
300} dtrace_dropdata_t;
301
302typedef int dtrace_handle_drop_f(const dtrace_dropdata_t *, void *);
303extern int dtrace_handle_drop(dtrace_hdl_t *, dtrace_handle_drop_f *, void *);
304
305typedef void dtrace_handle_proc_f(struct ps_prochandle *, const char *, void *);
306extern int dtrace_handle_proc(dtrace_hdl_t *, dtrace_handle_proc_f *, void *);
307
308#define DTRACE_BUFDATA_AGGKEY 0x0001 /* aggregation key */
309#define DTRACE_BUFDATA_AGGVAL 0x0002 /* aggregation value */
310#define DTRACE_BUFDATA_AGGFORMAT 0x0004 /* aggregation format data */
311#define DTRACE_BUFDATA_AGGLAST 0x0008 /* last for this key/val */
312
313typedef struct dtrace_bufdata {
314 dtrace_hdl_t *dtbda_handle; /* handle to DTrace library */
315 const char *dtbda_buffered; /* buffered output */
316 dtrace_probedata_t *dtbda_probe; /* probe data */
317 const dtrace_recdesc_t *dtbda_recdesc; /* record description */
318 const dtrace_aggdata_t *dtbda_aggdata; /* aggregation data, if agg. */
319 uint32_t dtbda_flags; /* flags; see above */
320} dtrace_bufdata_t;
321
322typedef int dtrace_handle_buffered_f(const dtrace_bufdata_t *, void *);
323extern int dtrace_handle_buffered(dtrace_hdl_t *,
324 dtrace_handle_buffered_f *, void *);
325
326typedef struct dtrace_setoptdata {
327 dtrace_hdl_t *dtsda_handle; /* handle to DTrace library */
328 const dtrace_probedata_t *dtsda_probe; /* probe data */
329 const char *dtsda_option; /* option that was set */
330 dtrace_optval_t dtsda_oldval; /* old value */
331 dtrace_optval_t dtsda_newval; /* new value */
332} dtrace_setoptdata_t;
333
334typedef int dtrace_handle_setopt_f(const dtrace_setoptdata_t *, void *);
335extern int dtrace_handle_setopt(dtrace_hdl_t *,
336 dtrace_handle_setopt_f *, void *);
337
338/*
339 * DTrace Aggregate Interface
340 */
341
342#define DTRACE_A_PERCPU 0x0001
343#define DTRACE_A_KEEPDELTA 0x0002
344#define DTRACE_A_ANONYMOUS 0x0004
345
346#define DTRACE_AGGWALK_ERROR -1 /* error while processing */
347#define DTRACE_AGGWALK_NEXT 0 /* proceed to next element */
348#define DTRACE_AGGWALK_ABORT 1 /* abort aggregation walk */
349#define DTRACE_AGGWALK_CLEAR 2 /* clear this element */
350#define DTRACE_AGGWALK_NORMALIZE 3 /* normalize this element */
351#define DTRACE_AGGWALK_DENORMALIZE 4 /* denormalize this element */
352#define DTRACE_AGGWALK_REMOVE 5 /* remove this element */
353
354struct dtrace_aggdata {
355 dtrace_hdl_t *dtada_handle; /* handle to DTrace library */
356 dtrace_aggdesc_t *dtada_desc; /* aggregation description */
357 dtrace_eprobedesc_t *dtada_edesc; /* enabled probe description */
358 dtrace_probedesc_t *dtada_pdesc; /* probe description */
359 caddr_t dtada_data; /* pointer to raw data */
360 uint64_t dtada_normal; /* the normal -- 1 for denorm */
361 size_t dtada_size; /* total size of the data */
362 caddr_t dtada_delta; /* delta data, if available */
363 caddr_t *dtada_percpu; /* per CPU data, if avail */
364 caddr_t *dtada_percpu_delta; /* per CPU delta, if avail */
365};
366
367typedef int dtrace_aggregate_f(const dtrace_aggdata_t *, void *);
368typedef int dtrace_aggregate_walk_f(dtrace_hdl_t *,
369 dtrace_aggregate_f *, void *);
370typedef int dtrace_aggregate_walk_joined_f(const dtrace_aggdata_t **,
371 const int, void *);
372
373extern void dtrace_aggregate_clear(dtrace_hdl_t *);
374extern int dtrace_aggregate_snap(dtrace_hdl_t *);
375extern int dtrace_aggregate_print(dtrace_hdl_t *, FILE *,
376 dtrace_aggregate_walk_f *);
377
378extern int dtrace_aggregate_walk(dtrace_hdl_t *, dtrace_aggregate_f *, void *);
379
380extern int dtrace_aggregate_walk_joined(dtrace_hdl_t *,
381 dtrace_aggvarid_t *, int, dtrace_aggregate_walk_joined_f *, void *);
382
383extern int dtrace_aggregate_walk_sorted(dtrace_hdl_t *,
384 dtrace_aggregate_f *, void *);
385
386extern int dtrace_aggregate_walk_keysorted(dtrace_hdl_t *,
387 dtrace_aggregate_f *, void *);
388
389extern int dtrace_aggregate_walk_valsorted(dtrace_hdl_t *,
390 dtrace_aggregate_f *, void *);
391
392extern int dtrace_aggregate_walk_keyvarsorted(dtrace_hdl_t *,
393 dtrace_aggregate_f *, void *);
394
395extern int dtrace_aggregate_walk_valvarsorted(dtrace_hdl_t *,
396 dtrace_aggregate_f *, void *);
397
398extern int dtrace_aggregate_walk_keyrevsorted(dtrace_hdl_t *,
399 dtrace_aggregate_f *, void *);
400
401extern int dtrace_aggregate_walk_valrevsorted(dtrace_hdl_t *,
402 dtrace_aggregate_f *, void *);
403
404extern int dtrace_aggregate_walk_keyvarrevsorted(dtrace_hdl_t *,
405 dtrace_aggregate_f *, void *);
406
407extern int dtrace_aggregate_walk_valvarrevsorted(dtrace_hdl_t *,
408 dtrace_aggregate_f *, void *);
409
410#define DTRACE_AGD_PRINTED 0x1 /* aggregation printed in program */
411
412/*
413 * DTrace Process Control Interface
414 *
415 * Library clients who wish to have libdtrace create or grab processes for
416 * monitoring of their symbol table changes may use these interfaces to
417 * request that libdtrace obtain control of the process using libproc.
418 */
419
420extern struct ps_prochandle *dtrace_proc_create(dtrace_hdl_t *,
421 const char *, char *const *);
422
423extern struct ps_prochandle *dtrace_proc_grab(dtrace_hdl_t *, pid_t, int);
424extern void dtrace_proc_release(dtrace_hdl_t *, struct ps_prochandle *);
425extern void dtrace_proc_continue(dtrace_hdl_t *, struct ps_prochandle *);
426
427/*
428 * DTrace Object, Symbol, and Type Interfaces
429 *
430 * Library clients can use libdtrace to perform symbol and C type information
431 * lookups by symbol name, symbol address, or C type name, or to lookup meta-
432 * information cached for each of the program objects in use by DTrace. The
433 * resulting struct contain pointers to arbitrary-length strings, including
434 * object, symbol, and type names, that are persistent until the next call to
435 * dtrace_update(). Once dtrace_update() is called, any cached values must
436 * be flushed and not used subsequently by the client program.
437 */
438
439#define DTRACE_OBJ_EXEC ((const char *)0L) /* primary executable file */
440#define DTRACE_OBJ_RTLD ((const char *)1L) /* run-time link-editor */
441#define DTRACE_OBJ_CDEFS ((const char *)2L) /* C include definitions */
442#define DTRACE_OBJ_DDEFS ((const char *)3L) /* D program definitions */
443#define DTRACE_OBJ_EVERY ((const char *)-1L) /* all known objects */
444#define DTRACE_OBJ_KMODS ((const char *)-2L) /* all kernel objects */
445#define DTRACE_OBJ_UMODS ((const char *)-3L) /* all user objects */
446
447typedef struct dtrace_objinfo {
448 const char *dto_name; /* object file scope name */
449 const char *dto_file; /* object file path (if any) */
450 int dto_id; /* object file id (if any) */
451 uint_t dto_flags; /* object flags (see below) */
452
453#ifndef VBOX
454 GElf_Addr dto_text_va; /* address of text section */
455 GElf_Xword dto_text_size; /* size of text section */
456 GElf_Addr dto_data_va; /* address of data section */
457 GElf_Xword dto_data_size; /* size of data section */
458 GElf_Addr dto_bss_va; /* address of BSS */
459 GElf_Xword dto_bss_size; /* size of BSS */
460#endif
461} dtrace_objinfo_t;
462
463#define DTRACE_OBJ_F_KERNEL 0x1 /* object is a kernel module */
464#define DTRACE_OBJ_F_PRIMARY 0x2 /* object is a primary module */
465
466typedef int dtrace_obj_f(dtrace_hdl_t *, const dtrace_objinfo_t *, void *);
467
468extern int dtrace_object_iter(dtrace_hdl_t *, dtrace_obj_f *, void *);
469extern int dtrace_object_info(dtrace_hdl_t *, const char *, dtrace_objinfo_t *);
470
471typedef struct dtrace_syminfo {
472 const char *dts_object; /* object name */
473 const char *dts_name; /* symbol name */
474 ulong_t dts_id; /* symbol id */
475} dtrace_syminfo_t;
476
477#ifndef VBOX
478extern int dtrace_lookup_by_name(dtrace_hdl_t *, const char *, const char *,
479 GElf_Sym *, dtrace_syminfo_t *);
480
481extern int dtrace_lookup_by_addr(dtrace_hdl_t *, GElf_Addr addr,
482 GElf_Sym *, dtrace_syminfo_t *);
483#endif /* !VBOX */
484
485typedef struct dtrace_typeinfo {
486 const char *dtt_object; /* object containing type */
487 ctf_file_t *dtt_ctfp; /* CTF container handle */
488 ctf_id_t dtt_type; /* CTF type identifier */
489} dtrace_typeinfo_t;
490
491extern int dtrace_lookup_by_type(dtrace_hdl_t *, const char *, const char *,
492 dtrace_typeinfo_t *);
493
494#ifndef VBOX
495extern int dtrace_symbol_type(dtrace_hdl_t *, const GElf_Sym *,
496 const dtrace_syminfo_t *, dtrace_typeinfo_t *);
497#endif
498
499extern int dtrace_type_strcompile(dtrace_hdl_t *,
500 const char *, dtrace_typeinfo_t *);
501
502extern int dtrace_type_fcompile(dtrace_hdl_t *,
503 FILE *, dtrace_typeinfo_t *);
504
505/*
506 * DTrace Probe Interface
507 *
508 * Library clients can use these functions to iterate over the set of available
509 * probe definitions and inquire as to their attributes. The probe iteration
510 * interfaces report probes that are declared as well as those from dtrace(7D).
511 */
512typedef struct dtrace_probeinfo {
513 dtrace_attribute_t dtp_attr; /* name attributes */
514 dtrace_attribute_t dtp_arga; /* arg attributes */
515 const dtrace_typeinfo_t *dtp_argv; /* arg types */
516 int dtp_argc; /* arg count */
517} dtrace_probeinfo_t;
518
519typedef int dtrace_probe_f(dtrace_hdl_t *, const dtrace_probedesc_t *, void *);
520
521extern int dtrace_probe_iter(dtrace_hdl_t *,
522 const dtrace_probedesc_t *pdp, dtrace_probe_f *, void *);
523
524extern int dtrace_probe_info(dtrace_hdl_t *,
525 const dtrace_probedesc_t *, dtrace_probeinfo_t *);
526
527/*
528 * DTrace Vector Interface
529 *
530 * The DTrace library normally speaks directly to dtrace(7D). However,
531 * this communication may be vectored elsewhere. Consumers who wish to
532 * perform a vectored open must fill in the vector, and use the dtrace_vopen()
533 * entry point to obtain a library handle.
534 */
535struct dtrace_vector {
536 int (*dtv_ioctl)(void *, int, void *);
537#ifndef VBOX
538 int (*dtv_lookup_by_addr)(void *, GElf_Addr, GElf_Sym *,
539 dtrace_syminfo_t *);
540#endif /* !VBOX */
541 int (*dtv_status)(void *, processorid_t);
542 long (*dtv_sysconf)(void *, int);
543};
544
545/*
546 * DTrace Utility Functions
547 *
548 * Library clients can use these functions to convert addresses strings, to
549 * convert between string and integer probe descriptions and the
550 * dtrace_probedesc_t representation, and to perform similar conversions on
551 * stability attributes.
552 */
553extern int dtrace_addr2str(dtrace_hdl_t *, uint64_t, char *, int);
554extern int dtrace_uaddr2str(dtrace_hdl_t *, pid_t, uint64_t, char *, int);
555
556extern int dtrace_xstr2desc(dtrace_hdl_t *, dtrace_probespec_t,
557 const char *, int, char *const [], dtrace_probedesc_t *);
558
559extern int dtrace_str2desc(dtrace_hdl_t *, dtrace_probespec_t,
560 const char *, dtrace_probedesc_t *);
561
562extern int dtrace_id2desc(dtrace_hdl_t *, dtrace_id_t, dtrace_probedesc_t *);
563
564#define DTRACE_DESC2STR_MAX 1024 /* min buf size for dtrace_desc2str() */
565
566extern char *dtrace_desc2str(const dtrace_probedesc_t *, char *, size_t);
567
568#define DTRACE_ATTR2STR_MAX 64 /* min buf size for dtrace_attr2str() */
569
570extern char *dtrace_attr2str(dtrace_attribute_t, char *, size_t);
571extern int dtrace_str2attr(const char *, dtrace_attribute_t *);
572
573extern const char *dtrace_stability_name(dtrace_stability_t);
574extern const char *dtrace_class_name(dtrace_class_t);
575
576extern int dtrace_provider_modules(dtrace_hdl_t *, const char **, int);
577
578extern const char *const _dtrace_version;
579extern int _dtrace_debug;
580
581#ifdef VBOX
582extern void dtrace_init(void);
583#endif
584
585#ifdef __cplusplus
586}
587#endif
588
589#endif /* _DTRACE_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette