Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
| Show All 19 Lines | |||||
| */ | */ | ||||
| /* | /* | ||||
| * Copyright 2007 Sun Microsystems, Inc. All rights reserved. | * Copyright 2007 Sun Microsystems, Inc. All rights reserved. | ||||
| * Use is subject to license terms. | * Use is subject to license terms. | ||||
| */ | */ | ||||
| /* | /* | ||||
| * Copyright (c) 2023 by Domagoj Stolfa. All rights reserved. | |||||
| * Copyright (c) 2014, 2016 by Delphix. All rights reserved. | * Copyright (c) 2014, 2016 by Delphix. All rights reserved. | ||||
| * Copyright (c) 2013, Joyent, Inc. All rights reserved. | * Copyright (c) 2013, Joyent, Inc. All rights reserved. | ||||
| */ | */ | ||||
| #ifndef _DTRACE_H | #ifndef _DTRACE_H | ||||
| #define _DTRACE_H | #define _DTRACE_H | ||||
| #include <sys/dtrace.h> | #include <sys/dtrace.h> | ||||
| ▲ Show 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | typedef struct dtrace_probedata { | ||||
| dtrace_hdl_t *dtpda_handle; /* handle to DTrace library */ | dtrace_hdl_t *dtpda_handle; /* handle to DTrace library */ | ||||
| dtrace_eprobedesc_t *dtpda_edesc; /* enabled probe description */ | dtrace_eprobedesc_t *dtpda_edesc; /* enabled probe description */ | ||||
| dtrace_probedesc_t *dtpda_pdesc; /* probe description */ | dtrace_probedesc_t *dtpda_pdesc; /* probe description */ | ||||
| processorid_t dtpda_cpu; /* CPU for data */ | processorid_t dtpda_cpu; /* CPU for data */ | ||||
| caddr_t dtpda_data; /* pointer to raw data */ | caddr_t dtpda_data; /* pointer to raw data */ | ||||
| dtrace_flowkind_t dtpda_flow; /* flow kind */ | dtrace_flowkind_t dtpda_flow; /* flow kind */ | ||||
| const char *dtpda_prefix; /* recommended flow prefix */ | const char *dtpda_prefix; /* recommended flow prefix */ | ||||
| int dtpda_indent; /* recommended flow indent */ | int dtpda_indent; /* recommended flow indent */ | ||||
| uint64_t dtpda_timestamp; /* hrtime of snapshot */ | |||||
| } dtrace_probedata_t; | } dtrace_probedata_t; | ||||
| typedef int dtrace_consume_probe_f(const dtrace_probedata_t *, void *); | typedef int dtrace_consume_probe_f(const dtrace_probedata_t *, void *); | ||||
| typedef int dtrace_consume_rec_f(const dtrace_probedata_t *, | typedef int dtrace_consume_rec_f(const dtrace_probedata_t *, | ||||
| const dtrace_recdesc_t *, void *); | const dtrace_recdesc_t *, void *); | ||||
| extern int dtrace_consume(dtrace_hdl_t *, FILE *, | extern int dtrace_consume(dtrace_hdl_t *, FILE *, | ||||
| dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *); | dtrace_consume_probe_f *, dtrace_consume_rec_f *, void *); | ||||
| Show All 17 Lines | |||||
| * the record description to obtain a format description. The dtfd_string | * the record description to obtain a format description. The dtfd_string | ||||
| * member of the format description may be passed to dtrace_print{fa}_create() | * member of the format description may be passed to dtrace_print{fa}_create() | ||||
| * to create the opaque format data. | * to create the opaque format data. | ||||
| */ | */ | ||||
| extern void *dtrace_printf_create(dtrace_hdl_t *, const char *); | extern void *dtrace_printf_create(dtrace_hdl_t *, const char *); | ||||
| extern void *dtrace_printa_create(dtrace_hdl_t *, const char *); | extern void *dtrace_printa_create(dtrace_hdl_t *, const char *); | ||||
| extern size_t dtrace_printf_format(dtrace_hdl_t *, void *, char *, size_t); | extern size_t dtrace_printf_format(dtrace_hdl_t *, void *, char *, size_t); | ||||
| extern int dtrace_sprintf(dtrace_hdl_t *, FILE *, void *, | |||||
| const dtrace_recdesc_t *, uint_t, | |||||
| const void *, size_t); | |||||
| extern int dtrace_fprintf(dtrace_hdl_t *, FILE *, void *, | extern int dtrace_fprintf(dtrace_hdl_t *, FILE *, void *, | ||||
| const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, | const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, | ||||
| const void *, size_t); | const void *, size_t); | ||||
| extern int dtrace_fprinta(dtrace_hdl_t *, FILE *, void *, | extern int dtrace_fprinta(dtrace_hdl_t *, FILE *, void *, | ||||
| const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, | const dtrace_probedata_t *, const dtrace_recdesc_t *, uint_t, | ||||
| const void *, size_t); | const void *, size_t); | ||||
| Show All 11 Lines | |||||
| * The print() action will associate a string data record that is actually the | * The print() action will associate a string data record that is actually the | ||||
| * fully-qualified type name of the data traced by the DIFEXPR action. This is | * fully-qualified type name of the data traced by the DIFEXPR action. This is | ||||
| * stored in the same 'format' record from the kernel, but we know by virtue of | * stored in the same 'format' record from the kernel, but we know by virtue of | ||||
| * the fact that the action is still DIFEXPR that it is actually a reference to | * the fact that the action is still DIFEXPR that it is actually a reference to | ||||
| * plain string data. | * plain string data. | ||||
| */ | */ | ||||
| extern int dtrace_print(dtrace_hdl_t *, FILE *, const char *, | extern int dtrace_print(dtrace_hdl_t *, FILE *, const char *, | ||||
| caddr_t, size_t); | caddr_t, size_t); | ||||
| extern int dtrace_format_print(dtrace_hdl_t *, FILE *, const char *, | |||||
| caddr_t, size_t); | |||||
| /* | /* | ||||
| * DTrace Work Interface | * DTrace Work Interface | ||||
| */ | */ | ||||
| typedef enum { | typedef enum { | ||||
| DTRACE_WORKSTATUS_ERROR = -1, | DTRACE_WORKSTATUS_ERROR = -1, | ||||
| DTRACE_WORKSTATUS_OKAY, | DTRACE_WORKSTATUS_OKAY, | ||||
| DTRACE_WORKSTATUS_DONE | DTRACE_WORKSTATUS_DONE | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } | } | ||||
| #endif | #endif | ||||
| #ifndef illumos | #ifndef illumos | ||||
| #define _SC_CPUID_MAX _SC_NPROCESSORS_CONF | #define _SC_CPUID_MAX _SC_NPROCESSORS_CONF | ||||
| #define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF | #define _SC_NPROCESSORS_MAX _SC_NPROCESSORS_CONF | ||||
| #endif | #endif | ||||
| /* | |||||
| * Values for the dt_oformat property. | |||||
| */ | |||||
| #define DTRACE_OFORMAT_TEXT 0 | |||||
| #define DTRACE_OFORMAT_STRUCTURED 1 | |||||
| extern int dtrace_oformat_configure(dtrace_hdl_t *); | |||||
| extern int dtrace_oformat(dtrace_hdl_t *); | |||||
| extern void dtrace_set_outfp(const FILE *); | |||||
| extern void dtrace_oformat_setup(dtrace_hdl_t *); | |||||
| extern void dtrace_oformat_teardown(dtrace_hdl_t *); | |||||
| extern void dtrace_oformat_probe(dtrace_hdl_t *, const dtrace_probedata_t *, | |||||
| processorid_t, dtrace_probedesc_t *); | |||||
| #endif /* _DTRACE_H */ | #endif /* _DTRACE_H */ | ||||