16ff6d951SJohn Birrell /* 26ff6d951SJohn Birrell * CDDL HEADER START 36ff6d951SJohn Birrell * 46ff6d951SJohn Birrell * The contents of this file are subject to the terms of the 56ff6d951SJohn Birrell * Common Development and Distribution License (the "License"). 66ff6d951SJohn Birrell * You may not use this file except in compliance with the License. 76ff6d951SJohn Birrell * 86ff6d951SJohn Birrell * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 96ff6d951SJohn Birrell * or http://www.opensolaris.org/os/licensing. 106ff6d951SJohn Birrell * See the License for the specific language governing permissions 116ff6d951SJohn Birrell * and limitations under the License. 126ff6d951SJohn Birrell * 136ff6d951SJohn Birrell * When distributing Covered Code, include this CDDL HEADER in each 146ff6d951SJohn Birrell * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 156ff6d951SJohn Birrell * If applicable, add the following below this CDDL HEADER, with the 166ff6d951SJohn Birrell * fields enclosed by brackets "[]" replaced with your own identifying 176ff6d951SJohn Birrell * information: Portions Copyright [yyyy] [name of copyright owner] 186ff6d951SJohn Birrell * 196ff6d951SJohn Birrell * CDDL HEADER END 206ff6d951SJohn Birrell */ 216ff6d951SJohn Birrell 226ff6d951SJohn Birrell /* 236ff6d951SJohn Birrell * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 246ff6d951SJohn Birrell * Use is subject to license terms. 256ff6d951SJohn Birrell */ 266ff6d951SJohn Birrell 27675cf915SPedro F. Giffuni /* 28*93f27766SDomagoj Stolfa * Copyright (c) 2023 by Domagoj Stolfa. All rights reserved. 29650f66acSMark Johnston * Copyright (c) 2014, 2016 by Delphix. All rights reserved. 308e648814SRui Paulo * Copyright (c) 2013, Joyent, Inc. All rights reserved. 31675cf915SPedro F. Giffuni */ 32675cf915SPedro F. Giffuni 336ff6d951SJohn Birrell #ifndef _DTRACE_H 346ff6d951SJohn Birrell #define _DTRACE_H 356ff6d951SJohn Birrell 366ff6d951SJohn Birrell #include <sys/dtrace.h> 376ff6d951SJohn Birrell #include <stdarg.h> 386ff6d951SJohn Birrell #include <stdio.h> 396ff6d951SJohn Birrell #include <gelf.h> 4056b35563SCraig Rodrigues #include <libproc.h> 41bc96366cSSteven Hartland #ifndef illumos 420f2bd1e8SRui Paulo #include <rtld_db.h> 430f2bd1e8SRui Paulo #endif 446ff6d951SJohn Birrell 456ff6d951SJohn Birrell #ifdef __cplusplus 466ff6d951SJohn Birrell extern "C" { 476ff6d951SJohn Birrell #endif 486ff6d951SJohn Birrell 496ff6d951SJohn Birrell /* 506ff6d951SJohn Birrell * DTrace Dynamic Tracing Software: Library Interfaces 516ff6d951SJohn Birrell * 526ff6d951SJohn Birrell * Note: The contents of this file are private to the implementation of the 536ff6d951SJohn Birrell * Solaris system and DTrace subsystem and are subject to change at any time 546ff6d951SJohn Birrell * without notice. Applications and drivers using these interfaces will fail 556ff6d951SJohn Birrell * to run on future releases. These interfaces should not be used for any 566ff6d951SJohn Birrell * purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). 576ff6d951SJohn Birrell * Please refer to the "Solaris Dynamic Tracing Guide" for more information. 586ff6d951SJohn Birrell */ 596ff6d951SJohn Birrell 606ff6d951SJohn Birrell #define DTRACE_VERSION 3 /* library ABI interface version */ 616ff6d951SJohn Birrell 626ff6d951SJohn Birrell struct ps_prochandle; 63650f66acSMark Johnston struct dt_node; 646ff6d951SJohn Birrell typedef struct dtrace_hdl dtrace_hdl_t; 656ff6d951SJohn Birrell typedef struct dtrace_prog dtrace_prog_t; 666ff6d951SJohn Birrell typedef struct dtrace_vector dtrace_vector_t; 676ff6d951SJohn Birrell typedef struct dtrace_aggdata dtrace_aggdata_t; 686ff6d951SJohn Birrell 696ff6d951SJohn Birrell #define DTRACE_O_NODEV 0x01 /* do not open dtrace(7D) device */ 706ff6d951SJohn Birrell #define DTRACE_O_NOSYS 0x02 /* do not load /system/object modules */ 716ff6d951SJohn Birrell #define DTRACE_O_LP64 0x04 /* force D compiler to be LP64 */ 726ff6d951SJohn Birrell #define DTRACE_O_ILP32 0x08 /* force D compiler to be ILP32 */ 736ff6d951SJohn Birrell #define DTRACE_O_MASK 0x0f /* mask of valid flags to dtrace_open */ 746ff6d951SJohn Birrell 756ff6d951SJohn Birrell extern dtrace_hdl_t *dtrace_open(int, int, int *); 766ff6d951SJohn Birrell extern dtrace_hdl_t *dtrace_vopen(int, int, int *, 776ff6d951SJohn Birrell const dtrace_vector_t *, void *); 786ff6d951SJohn Birrell 796ff6d951SJohn Birrell extern int dtrace_go(dtrace_hdl_t *); 806ff6d951SJohn Birrell extern int dtrace_stop(dtrace_hdl_t *); 816ff6d951SJohn Birrell extern void dtrace_sleep(dtrace_hdl_t *); 826ff6d951SJohn Birrell extern void dtrace_close(dtrace_hdl_t *); 836ff6d951SJohn Birrell 846ff6d951SJohn Birrell extern int dtrace_errno(dtrace_hdl_t *); 856ff6d951SJohn Birrell extern const char *dtrace_errmsg(dtrace_hdl_t *, int); 866ff6d951SJohn Birrell extern const char *dtrace_faultstr(dtrace_hdl_t *, int); 876ff6d951SJohn Birrell extern const char *dtrace_subrstr(dtrace_hdl_t *, int); 886ff6d951SJohn Birrell 896ff6d951SJohn Birrell extern int dtrace_setopt(dtrace_hdl_t *, const char *, const char *); 906ff6d951SJohn Birrell extern int dtrace_getopt(dtrace_hdl_t *, const char *, dtrace_optval_t *); 916ff6d951SJohn Birrell 926ff6d951SJohn Birrell extern void dtrace_update(dtrace_hdl_t *); 936ff6d951SJohn Birrell extern int dtrace_ctlfd(dtrace_hdl_t *); 946ff6d951SJohn Birrell 956ff6d951SJohn Birrell /* 966ff6d951SJohn Birrell * DTrace Program Interface 976ff6d951SJohn Birrell * 986ff6d951SJohn Birrell * DTrace programs can be created by compiling ASCII text files containing 996ff6d951SJohn Birrell * D programs or by compiling in-memory C strings that specify a D program. 1006ff6d951SJohn Birrell * Once created, callers can examine the list of program statements and 1016ff6d951SJohn Birrell * enable the probes and actions described by these statements. 1026ff6d951SJohn Birrell */ 1036ff6d951SJohn Birrell 1046ff6d951SJohn Birrell typedef struct dtrace_proginfo { 1056ff6d951SJohn Birrell dtrace_attribute_t dpi_descattr; /* minimum probedesc attributes */ 1066ff6d951SJohn Birrell dtrace_attribute_t dpi_stmtattr; /* minimum statement attributes */ 1076ff6d951SJohn Birrell uint_t dpi_aggregates; /* number of aggregates specified in program */ 1086ff6d951SJohn Birrell uint_t dpi_recgens; /* number of record generating probes in prog */ 1096ff6d951SJohn Birrell uint_t dpi_matches; /* number of probes matched by program */ 1106ff6d951SJohn Birrell uint_t dpi_speculations; /* number of speculations specified in prog */ 1116ff6d951SJohn Birrell } dtrace_proginfo_t; 1126ff6d951SJohn Birrell 1136ff6d951SJohn Birrell #define DTRACE_C_DIFV 0x0001 /* DIF verbose mode: show each compiled DIFO */ 1146ff6d951SJohn Birrell #define DTRACE_C_EMPTY 0x0002 /* Permit compilation of empty D source files */ 1156ff6d951SJohn Birrell #define DTRACE_C_ZDEFS 0x0004 /* Permit probe defs that match zero probes */ 1166ff6d951SJohn Birrell #define DTRACE_C_EATTR 0x0008 /* Error if program attributes less than min */ 1176ff6d951SJohn Birrell #define DTRACE_C_CPP 0x0010 /* Preprocess input file with cpp(1) utility */ 1186ff6d951SJohn Birrell #define DTRACE_C_KNODEF 0x0020 /* Permit unresolved kernel symbols in DIFO */ 1196ff6d951SJohn Birrell #define DTRACE_C_UNODEF 0x0040 /* Permit unresolved user symbols in DIFO */ 120650f66acSMark Johnston #define DTRACE_C_PSPEC 0x0080 /* Interpret ambiguous specifiers as probes */ 1216ff6d951SJohn Birrell #define DTRACE_C_ETAGS 0x0100 /* Prefix error messages with error tags */ 1226ff6d951SJohn Birrell #define DTRACE_C_ARGREF 0x0200 /* Do not require all macro args to be used */ 1231e136a9cSChristos Margiolis #define DTRACE_C_SUGAR 0x0400 /* Dump D script post-dt_sugar */ 1246ff6d951SJohn Birrell #define DTRACE_C_DEFARG 0x0800 /* Use 0/"" as value for unspecified args */ 1256ff6d951SJohn Birrell #define DTRACE_C_NOLIBS 0x1000 /* Do not process D system libraries */ 1266ff6d951SJohn Birrell #define DTRACE_C_CTL 0x2000 /* Only process control directives */ 1271e136a9cSChristos Margiolis #define DTRACE_C_MASK 0x3fff /* mask of all valid flags to dtrace_*compile */ 1286ff6d951SJohn Birrell 1296ff6d951SJohn Birrell extern dtrace_prog_t *dtrace_program_strcompile(dtrace_hdl_t *, 1306ff6d951SJohn Birrell const char *, dtrace_probespec_t, uint_t, int, char *const []); 1316ff6d951SJohn Birrell 1326ff6d951SJohn Birrell extern dtrace_prog_t *dtrace_program_fcompile(dtrace_hdl_t *, 1336ff6d951SJohn Birrell FILE *, uint_t, int, char *const []); 1346ff6d951SJohn Birrell 1356ff6d951SJohn Birrell extern int dtrace_program_exec(dtrace_hdl_t *, dtrace_prog_t *, 1366ff6d951SJohn Birrell dtrace_proginfo_t *); 1376ff6d951SJohn Birrell extern void dtrace_program_info(dtrace_hdl_t *, dtrace_prog_t *, 1386ff6d951SJohn Birrell dtrace_proginfo_t *); 1396ff6d951SJohn Birrell 1406ff6d951SJohn Birrell #define DTRACE_D_STRIP 0x01 /* strip non-loadable sections from program */ 1416ff6d951SJohn Birrell #define DTRACE_D_PROBES 0x02 /* include provider and probe definitions */ 1426ff6d951SJohn Birrell #define DTRACE_D_MASK 0x03 /* mask of valid flags to dtrace_dof_create */ 1436ff6d951SJohn Birrell 1446ff6d951SJohn Birrell extern int dtrace_program_link(dtrace_hdl_t *, dtrace_prog_t *, 1456ff6d951SJohn Birrell uint_t, const char *, int, char *const []); 1466ff6d951SJohn Birrell 1476ff6d951SJohn Birrell extern int dtrace_program_header(dtrace_hdl_t *, FILE *, const char *); 1486ff6d951SJohn Birrell 1496ff6d951SJohn Birrell extern void *dtrace_dof_create(dtrace_hdl_t *, dtrace_prog_t *, uint_t); 1506ff6d951SJohn Birrell extern void dtrace_dof_destroy(dtrace_hdl_t *, void *); 1516ff6d951SJohn Birrell 1526ff6d951SJohn Birrell extern void *dtrace_getopt_dof(dtrace_hdl_t *); 1536ff6d951SJohn Birrell extern void *dtrace_geterr_dof(dtrace_hdl_t *); 1546ff6d951SJohn Birrell 1556ff6d951SJohn Birrell typedef struct dtrace_stmtdesc { 1566ff6d951SJohn Birrell dtrace_ecbdesc_t *dtsd_ecbdesc; /* ECB description */ 1576ff6d951SJohn Birrell dtrace_actdesc_t *dtsd_action; /* action list */ 1586ff6d951SJohn Birrell dtrace_actdesc_t *dtsd_action_last; /* last action in action list */ 1596ff6d951SJohn Birrell void *dtsd_aggdata; /* aggregation data */ 1606ff6d951SJohn Birrell void *dtsd_fmtdata; /* type-specific output data */ 16154727873SPedro F. Giffuni void *dtsd_strdata; /* type-specific string data */ 162a76c5ce7SJohn Birrell void (*dtsd_callback)(void); /* callback function for EPID */ 1636ff6d951SJohn Birrell void *dtsd_data; /* callback data pointer */ 1646ff6d951SJohn Birrell dtrace_attribute_t dtsd_descattr; /* probedesc attributes */ 1656ff6d951SJohn Birrell dtrace_attribute_t dtsd_stmtattr; /* statement attributes */ 1666ff6d951SJohn Birrell } dtrace_stmtdesc_t; 1676ff6d951SJohn Birrell 1686ff6d951SJohn Birrell typedef int dtrace_stmt_f(dtrace_hdl_t *, dtrace_prog_t *, 1696ff6d951SJohn Birrell dtrace_stmtdesc_t *, void *); 1706ff6d951SJohn Birrell 1716ff6d951SJohn Birrell extern dtrace_stmtdesc_t *dtrace_stmt_create(dtrace_hdl_t *, 1726ff6d951SJohn Birrell dtrace_ecbdesc_t *); 1736ff6d951SJohn Birrell extern dtrace_actdesc_t *dtrace_stmt_action(dtrace_hdl_t *, 1746ff6d951SJohn Birrell dtrace_stmtdesc_t *); 1756ff6d951SJohn Birrell extern int dtrace_stmt_add(dtrace_hdl_t *, dtrace_prog_t *, 1766ff6d951SJohn Birrell dtrace_stmtdesc_t *); 1776ff6d951SJohn Birrell extern int dtrace_stmt_iter(dtrace_hdl_t *, dtrace_prog_t *, 1786ff6d951SJohn Birrell dtrace_stmt_f *, void *); 1796ff6d951SJohn Birrell extern void dtrace_stmt_destroy(dtrace_hdl_t *, dtrace_stmtdesc_t *); 1806ff6d951SJohn Birrell 1816ff6d951SJohn Birrell /* 1826ff6d951SJohn Birrell * DTrace Data Consumption Interface 1836ff6d951SJohn Birrell */ 1846ff6d951SJohn Birrell typedef enum { 1856ff6d951SJohn Birrell DTRACEFLOW_ENTRY, 1866ff6d951SJohn Birrell DTRACEFLOW_RETURN, 1876ff6d951SJohn Birrell DTRACEFLOW_NONE 1886ff6d951SJohn Birrell } dtrace_flowkind_t; 1896ff6d951SJohn Birrell 1906ff6d951SJohn Birrell #define DTRACE_CONSUME_ERROR -1 /* error while processing */ 1916ff6d951SJohn Birrell #define DTRACE_CONSUME_THIS 0 /* consume this probe/record */ 1926ff6d951SJohn Birrell #define DTRACE_CONSUME_NEXT 1 /* advance to next probe/rec */ 1936ff6d951SJohn Birrell #define DTRACE_CONSUME_ABORT 2 /* abort consumption */ 1946ff6d951SJohn Birrell 1956ff6d951SJohn Birrell typedef struct dtrace_probedata { 1966ff6d951SJohn Birrell dtrace_hdl_t *dtpda_handle; /* handle to DTrace library */ 1976ff6d951SJohn Birrell dtrace_eprobedesc_t *dtpda_edesc; /* enabled probe description */ 1986ff6d951SJohn Birrell dtrace_probedesc_t *dtpda_pdesc; /* probe description */ 1996ff6d951SJohn Birrell processorid_t dtpda_cpu; /* CPU for data */ 2006ff6d951SJohn Birrell caddr_t dtpda_data; /* pointer to raw data */ 2016ff6d951SJohn Birrell dtrace_flowkind_t dtpda_flow; /* flow kind */ 2026ff6d951SJohn Birrell const char *dtpda_prefix; /* recommended flow prefix */ 2036ff6d951SJohn Birrell int dtpda_indent; /* recommended flow indent */ 204*93f27766SDomagoj Stolfa uint64_t dtpda_timestamp; /* hrtime of snapshot */ 2056ff6d951SJohn Birrell } dtrace_probedata_t; 2066ff6d951SJohn Birrell 2076ff6d951SJohn Birrell typedef int dtrace_consume_probe_f(const dtrace_probedata_t *, void *); 2086ff6d951SJohn Birrell typedef int dtrace_consume_rec_f(const dtrace_probedata_t *, 2096ff6d951SJohn Birrell const dtrace_recdesc_t *, void *); 2106ff6d951SJohn Birrell 2116ff6d951SJohn Birrell extern int dtrace_consume(dtrace_hdl_t *, FILE *, 2126ff6d951SJohn Birrell dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *); 2136ff6d951SJohn Birrell 2146ff6d951SJohn Birrell #define DTRACE_STATUS_NONE 0 /* no status; not yet time */ 2156ff6d951SJohn Birrell #define DTRACE_STATUS_OKAY 1 /* status okay */ 2166ff6d951SJohn Birrell #define DTRACE_STATUS_EXITED 2 /* exit() was called; tracing stopped */ 2176ff6d951SJohn Birrell #define DTRACE_STATUS_FILLED 3 /* fill buffer filled; tracing stoped */ 2186ff6d951SJohn Birrell #define DTRACE_STATUS_STOPPED 4 /* tracing already stopped */ 2196ff6d951SJohn Birrell 2206ff6d951SJohn Birrell extern int dtrace_status(dtrace_hdl_t *); 2216ff6d951SJohn Birrell 2226ff6d951SJohn Birrell /* 2236ff6d951SJohn Birrell * DTrace Formatted Output Interfaces 2246ff6d951SJohn Birrell * 2256ff6d951SJohn Birrell * To format output associated with a given dtrace_stmtdesc, the caller can 2266ff6d951SJohn Birrell * invoke one of the following functions, passing the opaque dtsd_fmtdata and a 2276ff6d951SJohn Birrell * list of record descriptions. These functions return either -1 to indicate 2286ff6d951SJohn Birrell * an error, or a positive integer indicating the number of records consumed. 2296ff6d951SJohn Birrell * For anonymous enablings, the consumer can use the dtrd_format member of 2306ff6d951SJohn Birrell * the record description to obtain a format description. The dtfd_string 2316ff6d951SJohn Birrell * member of the format description may be passed to dtrace_print{fa}_create() 2326ff6d951SJohn Birrell * to create the opaque format data. 2336ff6d951SJohn Birrell */ 2346ff6d951SJohn Birrell extern void *dtrace_printf_create(dtrace_hdl_t *, const char *); 2356ff6d951SJohn Birrell extern void *dtrace_printa_create(dtrace_hdl_t *, const char *); 2366ff6d951SJohn Birrell extern size_t dtrace_printf_format(dtrace_hdl_t *, void *, char *, size_t); 2376ff6d951SJohn Birrell 238*93f27766SDomagoj Stolfa extern int dtrace_sprintf(dtrace_hdl_t *, FILE *, void *, 239*93f27766SDomagoj Stolfa const dtrace_recdesc_t *, uint_t, 240*93f27766SDomagoj Stolfa const void *, size_t); 241*93f27766SDomagoj Stolfa 2426ff6d951SJohn Birrell extern int dtrace_fprintf(dtrace_hdl_t *, FILE *, void *, 2436ff6d951SJohn Birrell const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, 2446ff6d951SJohn Birrell const void *, size_t); 2456ff6d951SJohn Birrell 2466ff6d951SJohn Birrell extern int dtrace_fprinta(dtrace_hdl_t *, FILE *, void *, 2476ff6d951SJohn Birrell const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, 2486ff6d951SJohn Birrell const void *, size_t); 2496ff6d951SJohn Birrell 2506ff6d951SJohn Birrell extern int dtrace_system(dtrace_hdl_t *, FILE *, void *, 2516ff6d951SJohn Birrell const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, 2526ff6d951SJohn Birrell const void *, size_t); 2536ff6d951SJohn Birrell 2546ff6d951SJohn Birrell extern int dtrace_freopen(dtrace_hdl_t *, FILE *, void *, 2556ff6d951SJohn Birrell const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, 2566ff6d951SJohn Birrell const void *, size_t); 2576ff6d951SJohn Birrell 2586ff6d951SJohn Birrell /* 25954727873SPedro F. Giffuni * Type-specific output printing 26054727873SPedro F. Giffuni * 26154727873SPedro F. Giffuni * The print() action will associate a string data record that is actually the 26254727873SPedro F. Giffuni * fully-qualified type name of the data traced by the DIFEXPR action. This is 26354727873SPedro F. Giffuni * stored in the same 'format' record from the kernel, but we know by virtue of 26454727873SPedro F. Giffuni * the fact that the action is still DIFEXPR that it is actually a reference to 26554727873SPedro F. Giffuni * plain string data. 26654727873SPedro F. Giffuni */ 26754727873SPedro F. Giffuni extern int dtrace_print(dtrace_hdl_t *, FILE *, const char *, 26854727873SPedro F. Giffuni caddr_t, size_t); 269*93f27766SDomagoj Stolfa extern int dtrace_format_print(dtrace_hdl_t *, FILE *, const char *, 270*93f27766SDomagoj Stolfa caddr_t, size_t); 27154727873SPedro F. Giffuni 27254727873SPedro F. Giffuni /* 2736ff6d951SJohn Birrell * DTrace Work Interface 2746ff6d951SJohn Birrell */ 2756ff6d951SJohn Birrell typedef enum { 2766ff6d951SJohn Birrell DTRACE_WORKSTATUS_ERROR = -1, 2776ff6d951SJohn Birrell DTRACE_WORKSTATUS_OKAY, 2786ff6d951SJohn Birrell DTRACE_WORKSTATUS_DONE 2796ff6d951SJohn Birrell } dtrace_workstatus_t; 2806ff6d951SJohn Birrell 2816ff6d951SJohn Birrell extern dtrace_workstatus_t dtrace_work(dtrace_hdl_t *, FILE *, 2826ff6d951SJohn Birrell dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *); 2836ff6d951SJohn Birrell 2846ff6d951SJohn Birrell /* 2856ff6d951SJohn Birrell * DTrace Handler Interface 2866ff6d951SJohn Birrell */ 2876ff6d951SJohn Birrell #define DTRACE_HANDLE_ABORT -1 /* abort current operation */ 2886ff6d951SJohn Birrell #define DTRACE_HANDLE_OK 0 /* handled okay; continue */ 2896ff6d951SJohn Birrell 2906ff6d951SJohn Birrell typedef struct dtrace_errdata { 2916ff6d951SJohn Birrell dtrace_hdl_t *dteda_handle; /* handle to DTrace library */ 2926ff6d951SJohn Birrell dtrace_eprobedesc_t *dteda_edesc; /* enabled probe inducing err */ 2936ff6d951SJohn Birrell dtrace_probedesc_t *dteda_pdesc; /* probe inducing error */ 2946ff6d951SJohn Birrell processorid_t dteda_cpu; /* CPU of error */ 2956ff6d951SJohn Birrell int dteda_action; /* action inducing error */ 2966ff6d951SJohn Birrell int dteda_offset; /* offset in DIFO of error */ 2976ff6d951SJohn Birrell int dteda_fault; /* specific fault */ 2986ff6d951SJohn Birrell uint64_t dteda_addr; /* address of fault, if any */ 2996ff6d951SJohn Birrell const char *dteda_msg; /* preconstructed message */ 3006ff6d951SJohn Birrell } dtrace_errdata_t; 3016ff6d951SJohn Birrell 3026ff6d951SJohn Birrell typedef int dtrace_handle_err_f(const dtrace_errdata_t *, void *); 3036ff6d951SJohn Birrell extern int dtrace_handle_err(dtrace_hdl_t *, dtrace_handle_err_f *, void *); 3046ff6d951SJohn Birrell 3056ff6d951SJohn Birrell typedef enum { 3066ff6d951SJohn Birrell DTRACEDROP_PRINCIPAL, /* drop to principal buffer */ 3076ff6d951SJohn Birrell DTRACEDROP_AGGREGATION, /* drop to aggregation buffer */ 3086ff6d951SJohn Birrell DTRACEDROP_DYNAMIC, /* dynamic drop */ 3096ff6d951SJohn Birrell DTRACEDROP_DYNRINSE, /* dyn drop due to rinsing */ 3106ff6d951SJohn Birrell DTRACEDROP_DYNDIRTY, /* dyn drop due to dirty */ 3116ff6d951SJohn Birrell DTRACEDROP_SPEC, /* speculative drop */ 3126ff6d951SJohn Birrell DTRACEDROP_SPECBUSY, /* spec drop due to busy */ 3136ff6d951SJohn Birrell DTRACEDROP_SPECUNAVAIL, /* spec drop due to unavail */ 3146ff6d951SJohn Birrell DTRACEDROP_STKSTROVERFLOW, /* stack string tab overflow */ 3156ff6d951SJohn Birrell DTRACEDROP_DBLERROR /* error in ERROR probe */ 3166ff6d951SJohn Birrell } dtrace_dropkind_t; 3176ff6d951SJohn Birrell 3186ff6d951SJohn Birrell typedef struct dtrace_dropdata { 3196ff6d951SJohn Birrell dtrace_hdl_t *dtdda_handle; /* handle to DTrace library */ 3206ff6d951SJohn Birrell processorid_t dtdda_cpu; /* CPU, if any */ 3216ff6d951SJohn Birrell dtrace_dropkind_t dtdda_kind; /* kind of drop */ 3226ff6d951SJohn Birrell uint64_t dtdda_drops; /* number of drops */ 3236ff6d951SJohn Birrell uint64_t dtdda_total; /* total drops */ 3246ff6d951SJohn Birrell const char *dtdda_msg; /* preconstructed message */ 3256ff6d951SJohn Birrell } dtrace_dropdata_t; 3266ff6d951SJohn Birrell 3276ff6d951SJohn Birrell typedef int dtrace_handle_drop_f(const dtrace_dropdata_t *, void *); 3286ff6d951SJohn Birrell extern int dtrace_handle_drop(dtrace_hdl_t *, dtrace_handle_drop_f *, void *); 3296ff6d951SJohn Birrell 3306ff6d951SJohn Birrell typedef void dtrace_handle_proc_f(struct ps_prochandle *, const char *, void *); 3316ff6d951SJohn Birrell extern int dtrace_handle_proc(dtrace_hdl_t *, dtrace_handle_proc_f *, void *); 3326ff6d951SJohn Birrell 3336ff6d951SJohn Birrell #define DTRACE_BUFDATA_AGGKEY 0x0001 /* aggregation key */ 3346ff6d951SJohn Birrell #define DTRACE_BUFDATA_AGGVAL 0x0002 /* aggregation value */ 3356ff6d951SJohn Birrell #define DTRACE_BUFDATA_AGGFORMAT 0x0004 /* aggregation format data */ 3366ff6d951SJohn Birrell #define DTRACE_BUFDATA_AGGLAST 0x0008 /* last for this key/val */ 3376ff6d951SJohn Birrell 3386ff6d951SJohn Birrell typedef struct dtrace_bufdata { 3396ff6d951SJohn Birrell dtrace_hdl_t *dtbda_handle; /* handle to DTrace library */ 3406ff6d951SJohn Birrell const char *dtbda_buffered; /* buffered output */ 3416ff6d951SJohn Birrell dtrace_probedata_t *dtbda_probe; /* probe data */ 3426ff6d951SJohn Birrell const dtrace_recdesc_t *dtbda_recdesc; /* record description */ 3436ff6d951SJohn Birrell const dtrace_aggdata_t *dtbda_aggdata; /* aggregation data, if agg. */ 3446ff6d951SJohn Birrell uint32_t dtbda_flags; /* flags; see above */ 3456ff6d951SJohn Birrell } dtrace_bufdata_t; 3466ff6d951SJohn Birrell 3476ff6d951SJohn Birrell typedef int dtrace_handle_buffered_f(const dtrace_bufdata_t *, void *); 3486ff6d951SJohn Birrell extern int dtrace_handle_buffered(dtrace_hdl_t *, 3496ff6d951SJohn Birrell dtrace_handle_buffered_f *, void *); 3506ff6d951SJohn Birrell 3516ff6d951SJohn Birrell typedef struct dtrace_setoptdata { 3526ff6d951SJohn Birrell dtrace_hdl_t *dtsda_handle; /* handle to DTrace library */ 3536ff6d951SJohn Birrell const dtrace_probedata_t *dtsda_probe; /* probe data */ 3546ff6d951SJohn Birrell const char *dtsda_option; /* option that was set */ 3556ff6d951SJohn Birrell dtrace_optval_t dtsda_oldval; /* old value */ 3566ff6d951SJohn Birrell dtrace_optval_t dtsda_newval; /* new value */ 3576ff6d951SJohn Birrell } dtrace_setoptdata_t; 3586ff6d951SJohn Birrell 3596ff6d951SJohn Birrell typedef int dtrace_handle_setopt_f(const dtrace_setoptdata_t *, void *); 3606ff6d951SJohn Birrell extern int dtrace_handle_setopt(dtrace_hdl_t *, 3616ff6d951SJohn Birrell dtrace_handle_setopt_f *, void *); 3626ff6d951SJohn Birrell 3636ff6d951SJohn Birrell /* 3646ff6d951SJohn Birrell * DTrace Aggregate Interface 3656ff6d951SJohn Birrell */ 3666ff6d951SJohn Birrell 3676ff6d951SJohn Birrell #define DTRACE_A_PERCPU 0x0001 3686ff6d951SJohn Birrell #define DTRACE_A_KEEPDELTA 0x0002 3696ff6d951SJohn Birrell #define DTRACE_A_ANONYMOUS 0x0004 370a43f0be9SRui Paulo #define DTRACE_A_TOTAL 0x0008 371a43f0be9SRui Paulo #define DTRACE_A_MINMAXBIN 0x0010 372a43f0be9SRui Paulo #define DTRACE_A_HASNEGATIVES 0x0020 373a43f0be9SRui Paulo #define DTRACE_A_HASPOSITIVES 0x0040 374a43f0be9SRui Paulo 375a43f0be9SRui Paulo #define DTRACE_AGGZOOM_MAX 0.95 /* height of max bar */ 3766ff6d951SJohn Birrell 3776ff6d951SJohn Birrell #define DTRACE_AGGWALK_ERROR -1 /* error while processing */ 3786ff6d951SJohn Birrell #define DTRACE_AGGWALK_NEXT 0 /* proceed to next element */ 3796ff6d951SJohn Birrell #define DTRACE_AGGWALK_ABORT 1 /* abort aggregation walk */ 3806ff6d951SJohn Birrell #define DTRACE_AGGWALK_CLEAR 2 /* clear this element */ 3816ff6d951SJohn Birrell #define DTRACE_AGGWALK_NORMALIZE 3 /* normalize this element */ 3826ff6d951SJohn Birrell #define DTRACE_AGGWALK_DENORMALIZE 4 /* denormalize this element */ 3836ff6d951SJohn Birrell #define DTRACE_AGGWALK_REMOVE 5 /* remove this element */ 3846ff6d951SJohn Birrell 3856ff6d951SJohn Birrell struct dtrace_aggdata { 3866ff6d951SJohn Birrell dtrace_hdl_t *dtada_handle; /* handle to DTrace library */ 3876ff6d951SJohn Birrell dtrace_aggdesc_t *dtada_desc; /* aggregation description */ 3886ff6d951SJohn Birrell dtrace_eprobedesc_t *dtada_edesc; /* enabled probe description */ 3896ff6d951SJohn Birrell dtrace_probedesc_t *dtada_pdesc; /* probe description */ 3906ff6d951SJohn Birrell caddr_t dtada_data; /* pointer to raw data */ 3916ff6d951SJohn Birrell uint64_t dtada_normal; /* the normal -- 1 for denorm */ 3926ff6d951SJohn Birrell size_t dtada_size; /* total size of the data */ 3936ff6d951SJohn Birrell caddr_t dtada_delta; /* delta data, if available */ 3946ff6d951SJohn Birrell caddr_t *dtada_percpu; /* per CPU data, if avail */ 3956ff6d951SJohn Birrell caddr_t *dtada_percpu_delta; /* per CPU delta, if avail */ 396a43f0be9SRui Paulo int64_t dtada_total; /* per agg total, if avail */ 397a43f0be9SRui Paulo uint16_t dtada_minbin; /* minimum bin, if avail */ 398a43f0be9SRui Paulo uint16_t dtada_maxbin; /* maximum bin, if avail */ 399a43f0be9SRui Paulo uint32_t dtada_flags; /* flags */ 4006ff6d951SJohn Birrell }; 4016ff6d951SJohn Birrell 4026ff6d951SJohn Birrell typedef int dtrace_aggregate_f(const dtrace_aggdata_t *, void *); 4036ff6d951SJohn Birrell typedef int dtrace_aggregate_walk_f(dtrace_hdl_t *, 4046ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4056ff6d951SJohn Birrell typedef int dtrace_aggregate_walk_joined_f(const dtrace_aggdata_t **, 4066ff6d951SJohn Birrell const int, void *); 4076ff6d951SJohn Birrell 4086ff6d951SJohn Birrell extern void dtrace_aggregate_clear(dtrace_hdl_t *); 4096ff6d951SJohn Birrell extern int dtrace_aggregate_snap(dtrace_hdl_t *); 4106ff6d951SJohn Birrell extern int dtrace_aggregate_print(dtrace_hdl_t *, FILE *, 4116ff6d951SJohn Birrell dtrace_aggregate_walk_f *); 4126ff6d951SJohn Birrell 4136ff6d951SJohn Birrell extern int dtrace_aggregate_walk(dtrace_hdl_t *, dtrace_aggregate_f *, void *); 4146ff6d951SJohn Birrell 4156ff6d951SJohn Birrell extern int dtrace_aggregate_walk_joined(dtrace_hdl_t *, 4166ff6d951SJohn Birrell dtrace_aggvarid_t *, int, dtrace_aggregate_walk_joined_f *, void *); 4176ff6d951SJohn Birrell 4186ff6d951SJohn Birrell extern int dtrace_aggregate_walk_sorted(dtrace_hdl_t *, 4196ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4206ff6d951SJohn Birrell 4216ff6d951SJohn Birrell extern int dtrace_aggregate_walk_keysorted(dtrace_hdl_t *, 4226ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4236ff6d951SJohn Birrell 4246ff6d951SJohn Birrell extern int dtrace_aggregate_walk_valsorted(dtrace_hdl_t *, 4256ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4266ff6d951SJohn Birrell 4276ff6d951SJohn Birrell extern int dtrace_aggregate_walk_keyvarsorted(dtrace_hdl_t *, 4286ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4296ff6d951SJohn Birrell 4306ff6d951SJohn Birrell extern int dtrace_aggregate_walk_valvarsorted(dtrace_hdl_t *, 4316ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4326ff6d951SJohn Birrell 4336ff6d951SJohn Birrell extern int dtrace_aggregate_walk_keyrevsorted(dtrace_hdl_t *, 4346ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4356ff6d951SJohn Birrell 4366ff6d951SJohn Birrell extern int dtrace_aggregate_walk_valrevsorted(dtrace_hdl_t *, 4376ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4386ff6d951SJohn Birrell 4396ff6d951SJohn Birrell extern int dtrace_aggregate_walk_keyvarrevsorted(dtrace_hdl_t *, 4406ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4416ff6d951SJohn Birrell 4426ff6d951SJohn Birrell extern int dtrace_aggregate_walk_valvarrevsorted(dtrace_hdl_t *, 4436ff6d951SJohn Birrell dtrace_aggregate_f *, void *); 4446ff6d951SJohn Birrell 4456ff6d951SJohn Birrell #define DTRACE_AGD_PRINTED 0x1 /* aggregation printed in program */ 4466ff6d951SJohn Birrell 4476ff6d951SJohn Birrell /* 4486ff6d951SJohn Birrell * DTrace Process Control Interface 4496ff6d951SJohn Birrell * 4506ff6d951SJohn Birrell * Library clients who wish to have libdtrace create or grab processes for 4516ff6d951SJohn Birrell * monitoring of their symbol table changes may use these interfaces to 4526ff6d951SJohn Birrell * request that libdtrace obtain control of the process using libproc. 4536ff6d951SJohn Birrell */ 4546ff6d951SJohn Birrell 4556ff6d951SJohn Birrell extern struct ps_prochandle *dtrace_proc_create(dtrace_hdl_t *, 45656b35563SCraig Rodrigues const char *, char *const *, proc_child_func *, void *); 4576ff6d951SJohn Birrell 4586ff6d951SJohn Birrell extern struct ps_prochandle *dtrace_proc_grab(dtrace_hdl_t *, pid_t, int); 4596ff6d951SJohn Birrell extern void dtrace_proc_release(dtrace_hdl_t *, struct ps_prochandle *); 4606ff6d951SJohn Birrell extern void dtrace_proc_continue(dtrace_hdl_t *, struct ps_prochandle *); 4616ff6d951SJohn Birrell 4626ff6d951SJohn Birrell /* 4636ff6d951SJohn Birrell * DTrace Object, Symbol, and Type Interfaces 4646ff6d951SJohn Birrell * 4656ff6d951SJohn Birrell * Library clients can use libdtrace to perform symbol and C type information 4666ff6d951SJohn Birrell * lookups by symbol name, symbol address, or C type name, or to lookup meta- 4676ff6d951SJohn Birrell * information cached for each of the program objects in use by DTrace. The 4686ff6d951SJohn Birrell * resulting struct contain pointers to arbitrary-length strings, including 4696ff6d951SJohn Birrell * object, symbol, and type names, that are persistent until the next call to 4706ff6d951SJohn Birrell * dtrace_update(). Once dtrace_update() is called, any cached values must 4716ff6d951SJohn Birrell * be flushed and not used subsequently by the client program. 4726ff6d951SJohn Birrell */ 4736ff6d951SJohn Birrell 4746ff6d951SJohn Birrell #define DTRACE_OBJ_EXEC ((const char *)0L) /* primary executable file */ 4756ff6d951SJohn Birrell #define DTRACE_OBJ_RTLD ((const char *)1L) /* run-time link-editor */ 4766ff6d951SJohn Birrell #define DTRACE_OBJ_CDEFS ((const char *)2L) /* C include definitions */ 4776ff6d951SJohn Birrell #define DTRACE_OBJ_DDEFS ((const char *)3L) /* D program definitions */ 4786ff6d951SJohn Birrell #define DTRACE_OBJ_EVERY ((const char *)-1L) /* all known objects */ 4796ff6d951SJohn Birrell #define DTRACE_OBJ_KMODS ((const char *)-2L) /* all kernel objects */ 4806ff6d951SJohn Birrell #define DTRACE_OBJ_UMODS ((const char *)-3L) /* all user objects */ 4816ff6d951SJohn Birrell 4826ff6d951SJohn Birrell typedef struct dtrace_objinfo { 4836ff6d951SJohn Birrell const char *dto_name; /* object file scope name */ 4846ff6d951SJohn Birrell const char *dto_file; /* object file path (if any) */ 4856ff6d951SJohn Birrell int dto_id; /* object file id (if any) */ 4866ff6d951SJohn Birrell uint_t dto_flags; /* object flags (see below) */ 4876ff6d951SJohn Birrell GElf_Addr dto_text_va; /* address of text section */ 4886ff6d951SJohn Birrell GElf_Xword dto_text_size; /* size of text section */ 4896ff6d951SJohn Birrell GElf_Addr dto_data_va; /* address of data section */ 4906ff6d951SJohn Birrell GElf_Xword dto_data_size; /* size of data section */ 4916ff6d951SJohn Birrell GElf_Addr dto_bss_va; /* address of BSS */ 4926ff6d951SJohn Birrell GElf_Xword dto_bss_size; /* size of BSS */ 4936ff6d951SJohn Birrell } dtrace_objinfo_t; 4946ff6d951SJohn Birrell 4956ff6d951SJohn Birrell #define DTRACE_OBJ_F_KERNEL 0x1 /* object is a kernel module */ 4966ff6d951SJohn Birrell #define DTRACE_OBJ_F_PRIMARY 0x2 /* object is a primary module */ 4976ff6d951SJohn Birrell 4986ff6d951SJohn Birrell typedef int dtrace_obj_f(dtrace_hdl_t *, const dtrace_objinfo_t *, void *); 4996ff6d951SJohn Birrell 5006ff6d951SJohn Birrell extern int dtrace_object_iter(dtrace_hdl_t *, dtrace_obj_f *, void *); 5016ff6d951SJohn Birrell extern int dtrace_object_info(dtrace_hdl_t *, const char *, dtrace_objinfo_t *); 5026ff6d951SJohn Birrell 5036ff6d951SJohn Birrell typedef struct dtrace_syminfo { 5046ff6d951SJohn Birrell const char *dts_object; /* object name */ 5056ff6d951SJohn Birrell const char *dts_name; /* symbol name */ 5066ff6d951SJohn Birrell ulong_t dts_id; /* symbol id */ 5076ff6d951SJohn Birrell } dtrace_syminfo_t; 5086ff6d951SJohn Birrell 5096ff6d951SJohn Birrell extern int dtrace_lookup_by_name(dtrace_hdl_t *, const char *, const char *, 5106ff6d951SJohn Birrell GElf_Sym *, dtrace_syminfo_t *); 5116ff6d951SJohn Birrell 5126ff6d951SJohn Birrell extern int dtrace_lookup_by_addr(dtrace_hdl_t *, GElf_Addr addr, 5136ff6d951SJohn Birrell GElf_Sym *, dtrace_syminfo_t *); 5146ff6d951SJohn Birrell 5156ff6d951SJohn Birrell typedef struct dtrace_typeinfo { 5166ff6d951SJohn Birrell const char *dtt_object; /* object containing type */ 5176ff6d951SJohn Birrell ctf_file_t *dtt_ctfp; /* CTF container handle */ 5186ff6d951SJohn Birrell ctf_id_t dtt_type; /* CTF type identifier */ 5198e648814SRui Paulo uint_t dtt_flags; /* Misc. flags */ 5206ff6d951SJohn Birrell } dtrace_typeinfo_t; 5216ff6d951SJohn Birrell 5228e648814SRui Paulo #define DTT_FL_USER 0x1 /* user type */ 5238e648814SRui Paulo 5246ff6d951SJohn Birrell extern int dtrace_lookup_by_type(dtrace_hdl_t *, const char *, const char *, 5256ff6d951SJohn Birrell dtrace_typeinfo_t *); 5266ff6d951SJohn Birrell 5276ff6d951SJohn Birrell extern int dtrace_symbol_type(dtrace_hdl_t *, const GElf_Sym *, 5286ff6d951SJohn Birrell const dtrace_syminfo_t *, dtrace_typeinfo_t *); 5296ff6d951SJohn Birrell 5306ff6d951SJohn Birrell extern int dtrace_type_strcompile(dtrace_hdl_t *, 5316ff6d951SJohn Birrell const char *, dtrace_typeinfo_t *); 5326ff6d951SJohn Birrell 5336ff6d951SJohn Birrell extern int dtrace_type_fcompile(dtrace_hdl_t *, 5346ff6d951SJohn Birrell FILE *, dtrace_typeinfo_t *); 5356ff6d951SJohn Birrell 536650f66acSMark Johnston extern struct dt_node *dt_compile_sugar(dtrace_hdl_t *, 537650f66acSMark Johnston struct dt_node *); 538650f66acSMark Johnston 539650f66acSMark Johnston 5406ff6d951SJohn Birrell /* 5416ff6d951SJohn Birrell * DTrace Probe Interface 5426ff6d951SJohn Birrell * 5436ff6d951SJohn Birrell * Library clients can use these functions to iterate over the set of available 5446ff6d951SJohn Birrell * probe definitions and inquire as to their attributes. The probe iteration 5456ff6d951SJohn Birrell * interfaces report probes that are declared as well as those from dtrace(7D). 5466ff6d951SJohn Birrell */ 5476ff6d951SJohn Birrell typedef struct dtrace_probeinfo { 5486ff6d951SJohn Birrell dtrace_attribute_t dtp_attr; /* name attributes */ 5496ff6d951SJohn Birrell dtrace_attribute_t dtp_arga; /* arg attributes */ 5506ff6d951SJohn Birrell const dtrace_typeinfo_t *dtp_argv; /* arg types */ 5516ff6d951SJohn Birrell int dtp_argc; /* arg count */ 5526ff6d951SJohn Birrell } dtrace_probeinfo_t; 5536ff6d951SJohn Birrell 5546ff6d951SJohn Birrell typedef int dtrace_probe_f(dtrace_hdl_t *, const dtrace_probedesc_t *, void *); 5556ff6d951SJohn Birrell 5566ff6d951SJohn Birrell extern int dtrace_probe_iter(dtrace_hdl_t *, 5576ff6d951SJohn Birrell const dtrace_probedesc_t *pdp, dtrace_probe_f *, void *); 5586ff6d951SJohn Birrell 5596ff6d951SJohn Birrell extern int dtrace_probe_info(dtrace_hdl_t *, 5606ff6d951SJohn Birrell const dtrace_probedesc_t *, dtrace_probeinfo_t *); 5616ff6d951SJohn Birrell 5626ff6d951SJohn Birrell /* 5636ff6d951SJohn Birrell * DTrace Vector Interface 5646ff6d951SJohn Birrell * 5656ff6d951SJohn Birrell * The DTrace library normally speaks directly to dtrace(7D). However, 5666ff6d951SJohn Birrell * this communication may be vectored elsewhere. Consumers who wish to 5676ff6d951SJohn Birrell * perform a vectored open must fill in the vector, and use the dtrace_vopen() 5686ff6d951SJohn Birrell * entry point to obtain a library handle. 5696ff6d951SJohn Birrell */ 5706ff6d951SJohn Birrell struct dtrace_vector { 571bc96366cSSteven Hartland #ifdef illumos 5726ff6d951SJohn Birrell int (*dtv_ioctl)(void *, int, void *); 573a76c5ce7SJohn Birrell #else 574a76c5ce7SJohn Birrell int (*dtv_ioctl)(void *, u_long, void *); 575a76c5ce7SJohn Birrell #endif 5766ff6d951SJohn Birrell int (*dtv_lookup_by_addr)(void *, GElf_Addr, GElf_Sym *, 5776ff6d951SJohn Birrell dtrace_syminfo_t *); 5786ff6d951SJohn Birrell int (*dtv_status)(void *, processorid_t); 5796ff6d951SJohn Birrell long (*dtv_sysconf)(void *, int); 5806ff6d951SJohn Birrell }; 5816ff6d951SJohn Birrell 5826ff6d951SJohn Birrell /* 5836ff6d951SJohn Birrell * DTrace Utility Functions 5846ff6d951SJohn Birrell * 5856ff6d951SJohn Birrell * Library clients can use these functions to convert addresses strings, to 5866ff6d951SJohn Birrell * convert between string and integer probe descriptions and the 5876ff6d951SJohn Birrell * dtrace_probedesc_t representation, and to perform similar conversions on 5886ff6d951SJohn Birrell * stability attributes. 5896ff6d951SJohn Birrell */ 5906ff6d951SJohn Birrell extern int dtrace_addr2str(dtrace_hdl_t *, uint64_t, char *, int); 5916ff6d951SJohn Birrell extern int dtrace_uaddr2str(dtrace_hdl_t *, pid_t, uint64_t, char *, int); 5926ff6d951SJohn Birrell 5936ff6d951SJohn Birrell extern int dtrace_xstr2desc(dtrace_hdl_t *, dtrace_probespec_t, 5946ff6d951SJohn Birrell const char *, int, char *const [], dtrace_probedesc_t *); 5956ff6d951SJohn Birrell 5966ff6d951SJohn Birrell extern int dtrace_str2desc(dtrace_hdl_t *, dtrace_probespec_t, 5976ff6d951SJohn Birrell const char *, dtrace_probedesc_t *); 5986ff6d951SJohn Birrell 5996ff6d951SJohn Birrell extern int dtrace_id2desc(dtrace_hdl_t *, dtrace_id_t, dtrace_probedesc_t *); 6006ff6d951SJohn Birrell 6016ff6d951SJohn Birrell #define DTRACE_DESC2STR_MAX 1024 /* min buf size for dtrace_desc2str() */ 6026ff6d951SJohn Birrell 6036ff6d951SJohn Birrell extern char *dtrace_desc2str(const dtrace_probedesc_t *, char *, size_t); 6046ff6d951SJohn Birrell 6056ff6d951SJohn Birrell #define DTRACE_ATTR2STR_MAX 64 /* min buf size for dtrace_attr2str() */ 6066ff6d951SJohn Birrell 6076ff6d951SJohn Birrell extern char *dtrace_attr2str(dtrace_attribute_t, char *, size_t); 6086ff6d951SJohn Birrell extern int dtrace_str2attr(const char *, dtrace_attribute_t *); 6096ff6d951SJohn Birrell 6106ff6d951SJohn Birrell extern const char *dtrace_stability_name(dtrace_stability_t); 6116ff6d951SJohn Birrell extern const char *dtrace_class_name(dtrace_class_t); 6126ff6d951SJohn Birrell 6136ff6d951SJohn Birrell extern int dtrace_provider_modules(dtrace_hdl_t *, const char **, int); 6146ff6d951SJohn Birrell 6156ff6d951SJohn Birrell extern const char *const _dtrace_version; 6166ff6d951SJohn Birrell extern int _dtrace_debug; 6176ff6d951SJohn Birrell 6186ff6d951SJohn Birrell #ifdef __cplusplus 6196ff6d951SJohn Birrell } 6206ff6d951SJohn Birrell #endif 6216ff6d951SJohn Birrell 622bc96366cSSteven Hartland #ifndef illumos 623a76c5ce7SJohn Birrell #define _SC_CPUID_MAX _SC_NPROCESSORS_CONF 624a76c5ce7SJohn Birrell #define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF 625a76c5ce7SJohn Birrell #endif 626a76c5ce7SJohn Birrell 627*93f27766SDomagoj Stolfa /* 628*93f27766SDomagoj Stolfa * Values for the dt_oformat property. 629*93f27766SDomagoj Stolfa */ 630*93f27766SDomagoj Stolfa #define DTRACE_OFORMAT_TEXT 0 631*93f27766SDomagoj Stolfa #define DTRACE_OFORMAT_STRUCTURED 1 632*93f27766SDomagoj Stolfa 633*93f27766SDomagoj Stolfa extern int dtrace_oformat_configure(dtrace_hdl_t *); 634*93f27766SDomagoj Stolfa extern int dtrace_oformat(dtrace_hdl_t *); 635*93f27766SDomagoj Stolfa extern void dtrace_set_outfp(const FILE *); 636*93f27766SDomagoj Stolfa extern void dtrace_oformat_setup(dtrace_hdl_t *); 637*93f27766SDomagoj Stolfa extern void dtrace_oformat_teardown(dtrace_hdl_t *); 638*93f27766SDomagoj Stolfa extern void dtrace_oformat_probe(dtrace_hdl_t *, const dtrace_probedata_t *, 639*93f27766SDomagoj Stolfa processorid_t, dtrace_probedesc_t *); 640*93f27766SDomagoj Stolfa 6416ff6d951SJohn Birrell #endif /* _DTRACE_H */ 642