#include <sys/dtrace.h>

sys/dtrace.h

DTrace Dynamic Tracing Software: Kernel Interfaces Note: The contents of this file are private to the implementation of the Solaris system and DTrace subsystem and are subject to change at any time without notice. Applications and drivers using these interfaces will fail to run on future releases. These interfaces should not be used for any purpose except those expressly outlined in dtrace(7D) and libdtrace(3LIB). Please refer to the "Solaris Dynamic Tracing Guide" for more information.
includes: sys/types.h, sys/param.h, stdint.h, sys/ioctl.h, sys/dtrace_glue.h, stdarg.h, os/overflow.h
535 macros · 70 typedefs · 41 structs · 2 enums

macro_LITTLE_ENDIAN

#define _LITTLE_ENDIAN 
Solaris vs. Darwin

macroSEC

#define SEC 1

macroMILLISEC

#define MILLISEC 1000

macroMICROSEC

#define MICROSEC 1000000

macroNANOSEC

#define NANOSEC 1000000000

macroS_ROUND

#define S_ROUND(x, a) ((x) + (((a) ? (a) : 1) - 1) & ~(((a) ? (a) : 1) - 1))

macroP2ROUNDUP

#define P2ROUNDUP(x, align) (-(-(x) & -(align)))

macroP2PHASEUP

#define P2PHASEUP(x, align, phase) ((phase) - (((phase) - (x)) & -(align)))

macroCTF_MODEL_ILP32

#define CTF_MODEL_ILP32 1
object data model is ILP32

macroCTF_MODEL_LP64

#define CTF_MODEL_LP64 2
object data model is LP64

macroCTF_MODEL_NATIVE

#define CTF_MODEL_NATIVE CTF_MODEL_LP64

typedefuchar_t

typedef uint8_t uchar_t

typedefushort_t

typedef uint16_t ushort_t

typedefuint_t

typedef uint32_t uint_t

typedefulong_t

typedef unsigned long ulong_t

typedefu_longlong_t

typedef uint64_t u_longlong_t

typedeflonglong_t

typedef int64_t longlong_t

typedefoff64_t

typedef int64_t off64_t

typedefprocessorid_t

typedef int processorid_t

typedefhrtime_t

typedef int64_t hrtime_t

enum_dtrace_boolean

underlying type unsigned int
B_FALSE0
B_TRUE1

typedef_dtrace_boolean

typedef enum { B_FALSE = 0, B_TRUE = 1 } _dtrace_boolean

typedefUUID

typedef uint8_t UUID[16]
For modctl use in dtrace.h

typedefctf_file_t

In lieu of Solaris <sys/ctf_api.h>
typedef struct ctf_file ctf_file_t

typedefctf_id_t

typedef long ctf_id_t

typedefzoneid_t

typedef uint32_t zoneid_t

typedef__va_list

typedef va_list __va_list

macroproc_t

Solaris proc_t is the struct. Darwin's proc_t is a pointer to it.
#define proc_t struct proc
Steer clear of the Darwin typedef for proc_t

macroDTRACE_CPUALL

DTrace Universal Constants and Typedefs
#define DTRACE_CPUALL -1
all CPUs

macroDTRACE_IDNONE

#define DTRACE_IDNONE 0
invalid probe identifier

macroDTRACE_EPIDNONE

#define DTRACE_EPIDNONE 0
invalid enabled probe identifier

macroDTRACE_AGGIDNONE

#define DTRACE_AGGIDNONE 0
invalid aggregation identifier

macroDTRACE_AGGVARIDNONE

#define DTRACE_AGGVARIDNONE 0
invalid aggregation variable ID

macroDTRACE_CACHEIDNONE

#define DTRACE_CACHEIDNONE 0
invalid predicate cache

macroDTRACE_PROVNONE

#define DTRACE_PROVNONE 0
invalid provider identifier

macroDTRACE_METAPROVNONE

#define DTRACE_METAPROVNONE 0
invalid meta-provider identifier

macroDTRACE_ARGNONE

#define DTRACE_ARGNONE -1
invalid argument index

macroDTRACE_PROVNAMELEN

#define DTRACE_PROVNAMELEN 64

macroDTRACE_MODNAMELEN

#define DTRACE_MODNAMELEN 64

macroDTRACE_FUNCNAMELEN

#define DTRACE_FUNCNAMELEN 128

macroDTRACE_NAMELEN

#define DTRACE_NAMELEN 64

macroDTRACE_ARGTYPELEN

#define DTRACE_ARGTYPELEN 128

typedefdtrace_id_t

typedef uint32_t dtrace_id_t
probe identifier

typedefdtrace_epid_t

typedef uint32_t dtrace_epid_t
enabled probe identifier

typedefdtrace_aggid_t

typedef uint32_t dtrace_aggid_t
aggregation identifier

typedefdtrace_aggvarid_t

typedef int64_t dtrace_aggvarid_t
aggregation variable identifier

typedefdtrace_actkind_t

typedef uint16_t dtrace_actkind_t
action kind

typedefdtrace_optval_t

typedef int64_t dtrace_optval_t
option value

typedefdtrace_cacheid_t

typedef uint32_t dtrace_cacheid_t
predicate cache identifier

enumdtrace_probespec

underlying type int
DTRACE_PROBESPEC_NONE-1
DTRACE_PROBESPEC_PROVIDER0
DTRACE_PROBESPEC_MOD1
DTRACE_PROBESPEC_FUNC2
DTRACE_PROBESPEC_NAME3

typedefdtrace_probespec_t

typedef enum dtrace_probespec dtrace_probespec_t;

macroDIF_VERSION_1

DTrace Intermediate Format (DIF) The following definitions describe the DTrace Intermediate Format (DIF), a a RISC-like instruction set and program encoding used to represent predicates and actions that can be bound to DTrace probes. The constants below defining the number of available registers are suggested minimums; the compiler should use DTRACEIOC_CONF to dynamically obtain the number of registers provided by the current DTrace implementation.
#define DIF_VERSION_1 1
DIF version 1: Solaris 10 Beta

macroDIF_VERSION_2

#define DIF_VERSION_2 2
DIF version 2: Solaris 10 FCS

macroDIF_VERSION

#define DIF_VERSION DIF_VERSION_2
latest DIF instruction set version

macroDIF_DIR_NREGS

#define DIF_DIR_NREGS 8
number of DIF integer registers

macroDIF_DTR_NREGS

#define DIF_DTR_NREGS 8
number of DIF tuple registers

macroDIF_OP_OR

#define DIF_OP_OR 1
or r1, r2, rd

macroDIF_OP_XOR

#define DIF_OP_XOR 2
xor r1, r2, rd

macroDIF_OP_AND

#define DIF_OP_AND 3
and r1, r2, rd

macroDIF_OP_SLL

#define DIF_OP_SLL 4
sll r1, r2, rd

macroDIF_OP_SRL

#define DIF_OP_SRL 5
srl r1, r2, rd

macroDIF_OP_SUB

#define DIF_OP_SUB 6
sub r1, r2, rd

macroDIF_OP_ADD

#define DIF_OP_ADD 7
add r1, r2, rd

macroDIF_OP_MUL

#define DIF_OP_MUL 8
mul r1, r2, rd

macroDIF_OP_SDIV

#define DIF_OP_SDIV 9
sdiv r1, r2, rd

macroDIF_OP_UDIV

#define DIF_OP_UDIV 10
udiv r1, r2, rd

macroDIF_OP_SREM

#define DIF_OP_SREM 11
srem r1, r2, rd

macroDIF_OP_UREM

#define DIF_OP_UREM 12
urem r1, r2, rd

macroDIF_OP_NOT

#define DIF_OP_NOT 13
not r1, rd

macroDIF_OP_MOV

#define DIF_OP_MOV 14
mov r1, rd

macroDIF_OP_CMP

#define DIF_OP_CMP 15
cmp r1, r2

macroDIF_OP_TST

#define DIF_OP_TST 16
tst r1

macroDIF_OP_BA

#define DIF_OP_BA 17
ba label

macroDIF_OP_BE

#define DIF_OP_BE 18
be label

macroDIF_OP_BNE

#define DIF_OP_BNE 19
bne label

macroDIF_OP_BG

#define DIF_OP_BG 20
bg label

macroDIF_OP_BGU

#define DIF_OP_BGU 21
bgu label

macroDIF_OP_BGE

#define DIF_OP_BGE 22
bge label

macroDIF_OP_BGEU

#define DIF_OP_BGEU 23
bgeu label

macroDIF_OP_BL

#define DIF_OP_BL 24
bl label

macroDIF_OP_BLU

#define DIF_OP_BLU 25
blu label

macroDIF_OP_BLE

#define DIF_OP_BLE 26
ble label

macroDIF_OP_BLEU

#define DIF_OP_BLEU 27
bleu label

macroDIF_OP_LDSB

#define DIF_OP_LDSB 28
ldsb [r1], rd

macroDIF_OP_LDSH

#define DIF_OP_LDSH 29
ldsh [r1], rd

macroDIF_OP_LDSW

#define DIF_OP_LDSW 30
ldsw [r1], rd

macroDIF_OP_LDUB

#define DIF_OP_LDUB 31
ldub [r1], rd

macroDIF_OP_LDUH

#define DIF_OP_LDUH 32
lduh [r1], rd

macroDIF_OP_LDUW

#define DIF_OP_LDUW 33
lduw [r1], rd

macroDIF_OP_LDX

#define DIF_OP_LDX 34
ldx [r1], rd

macroDIF_OP_RET

#define DIF_OP_RET 35
ret rd

macroDIF_OP_NOP

#define DIF_OP_NOP 36
nop

macroDIF_OP_SETX

#define DIF_OP_SETX 37
setx intindex, rd

macroDIF_OP_SETS

#define DIF_OP_SETS 38
sets strindex, rd

macroDIF_OP_SCMP

#define DIF_OP_SCMP 39
scmp r1, r2

macroDIF_OP_LDGA

#define DIF_OP_LDGA 40
ldga var, ri, rd

macroDIF_OP_LDGS

#define DIF_OP_LDGS 41
ldgs var, rd

macroDIF_OP_STGS

#define DIF_OP_STGS 42
stgs var, rs

macroDIF_OP_LDTA

#define DIF_OP_LDTA 43
ldta var, ri, rd

macroDIF_OP_LDTS

#define DIF_OP_LDTS 44
ldts var, rd

macroDIF_OP_STTS

#define DIF_OP_STTS 45
stts var, rs

macroDIF_OP_SRA

#define DIF_OP_SRA 46
sra r1, r2, rd

macroDIF_OP_CALL

#define DIF_OP_CALL 47
call subr, rd

macroDIF_OP_PUSHTR

#define DIF_OP_PUSHTR 48
pushtr type, rs, rr

macroDIF_OP_PUSHTV

#define DIF_OP_PUSHTV 49
pushtv type, rs, rv

macroDIF_OP_POPTS

#define DIF_OP_POPTS 50
popts

macroDIF_OP_FLUSHTS

#define DIF_OP_FLUSHTS 51
flushts

macroDIF_OP_LDGAA

#define DIF_OP_LDGAA 52
ldgaa var, rd

macroDIF_OP_LDTAA

#define DIF_OP_LDTAA 53
ldtaa var, rd

macroDIF_OP_STGAA

#define DIF_OP_STGAA 54
stgaa var, rs

macroDIF_OP_STTAA

#define DIF_OP_STTAA 55
sttaa var, rs

macroDIF_OP_LDLS

#define DIF_OP_LDLS 56
ldls var, rd

macroDIF_OP_STLS

#define DIF_OP_STLS 57
stls var, rs

macroDIF_OP_ALLOCS

#define DIF_OP_ALLOCS 58
allocs r1, rd

macroDIF_OP_COPYS

#define DIF_OP_COPYS 59
copys r1, r2, rd

macroDIF_OP_STB

#define DIF_OP_STB 60
stb r1, [rd]

macroDIF_OP_STH

#define DIF_OP_STH 61
sth r1, [rd]

macroDIF_OP_STW

#define DIF_OP_STW 62
stw r1, [rd]

macroDIF_OP_STX

#define DIF_OP_STX 63
stx r1, [rd]

macroDIF_OP_ULDSB

#define DIF_OP_ULDSB 64
uldsb [r1], rd

macroDIF_OP_ULDSH

#define DIF_OP_ULDSH 65
uldsh [r1], rd

macroDIF_OP_ULDSW

#define DIF_OP_ULDSW 66
uldsw [r1], rd

macroDIF_OP_ULDUB

#define DIF_OP_ULDUB 67
uldub [r1], rd

macroDIF_OP_ULDUH

#define DIF_OP_ULDUH 68
ulduh [r1], rd

macroDIF_OP_ULDUW

#define DIF_OP_ULDUW 69
ulduw [r1], rd

macroDIF_OP_ULDX

#define DIF_OP_ULDX 70
uldx [r1], rd

macroDIF_OP_RLDSB

#define DIF_OP_RLDSB 71
rldsb [r1], rd

macroDIF_OP_RLDSH

#define DIF_OP_RLDSH 72
rldsh [r1], rd

macroDIF_OP_RLDSW

#define DIF_OP_RLDSW 73
rldsw [r1], rd

macroDIF_OP_RLDUB

#define DIF_OP_RLDUB 74
rldub [r1], rd

macroDIF_OP_RLDUH

#define DIF_OP_RLDUH 75
rlduh [r1], rd

macroDIF_OP_RLDUW

#define DIF_OP_RLDUW 76
rlduw [r1], rd

macroDIF_OP_RLDX

#define DIF_OP_RLDX 77
rldx [r1], rd

macroDIF_OP_XLATE

#define DIF_OP_XLATE 78
xlate xlrindex, rd

macroDIF_OP_XLARG

#define DIF_OP_XLARG 79
xlarg xlrindex, rd

macroDIF_OP_STRIP

#define DIF_OP_STRIP 80
strip r1, key, rd

macroDIF_INTOFF_MAX

#define DIF_INTOFF_MAX 0xffff
highest integer table offset

macroDIF_STROFF_MAX

#define DIF_STROFF_MAX 0xffff
highest string table offset

macroDIF_REGISTER_MAX

#define DIF_REGISTER_MAX 0xff
highest register number

macroDIF_VARIABLE_MAX

#define DIF_VARIABLE_MAX 0xffff
highest variable identifier

macroDIF_SUBROUTINE_MAX

#define DIF_SUBROUTINE_MAX 0xffff
highest subroutine code

macroDIF_VAR_ARRAY_MIN

#define DIF_VAR_ARRAY_MIN 0x0000
lowest numbered array variable

macroDIF_VAR_ARRAY_UBASE

#define DIF_VAR_ARRAY_UBASE 0x0080
lowest user-defined array

macroDIF_VAR_ARRAY_MAX

#define DIF_VAR_ARRAY_MAX 0x00ff
highest numbered array variable

macroDIF_VAR_OTHER_MIN

#define DIF_VAR_OTHER_MIN 0x0100
lowest numbered scalar or assc

macroDIF_VAR_OTHER_UBASE

#define DIF_VAR_OTHER_UBASE 0x0500
lowest user-defined scalar or assc

macroDIF_VAR_OTHER_MAX

#define DIF_VAR_OTHER_MAX 0xffff
highest numbered scalar or assc

macroDIF_VAR_ARGS

#define DIF_VAR_ARGS 0x0000
arguments array

macroDIF_VAR_REGS

#define DIF_VAR_REGS 0x0001
registers array

macroDIF_VAR_UREGS

#define DIF_VAR_UREGS 0x0002
user registers array

macroDIF_VAR_VMREGS

#define DIF_VAR_VMREGS 0x0003
virtual machine registers array

macroDIF_VAR_CURTHREAD

#define DIF_VAR_CURTHREAD 0x0100
thread pointer

macroDIF_VAR_TIMESTAMP

#define DIF_VAR_TIMESTAMP 0x0101
timestamp

macroDIF_VAR_VTIMESTAMP

#define DIF_VAR_VTIMESTAMP 0x0102
virtual timestamp

macroDIF_VAR_IPL

#define DIF_VAR_IPL 0x0103
interrupt priority level

macroDIF_VAR_EPID

#define DIF_VAR_EPID 0x0104
enabled probe ID

macroDIF_VAR_ID

#define DIF_VAR_ID 0x0105
probe ID

macroDIF_VAR_ARG0

#define DIF_VAR_ARG0 0x0106
first argument

macroDIF_VAR_ARG1

#define DIF_VAR_ARG1 0x0107
second argument

macroDIF_VAR_ARG2

#define DIF_VAR_ARG2 0x0108
third argument

macroDIF_VAR_ARG3

#define DIF_VAR_ARG3 0x0109
fourth argument

macroDIF_VAR_ARG4

#define DIF_VAR_ARG4 0x010a
fifth argument

macroDIF_VAR_ARG5

#define DIF_VAR_ARG5 0x010b
sixth argument

macroDIF_VAR_ARG6

#define DIF_VAR_ARG6 0x010c
seventh argument

macroDIF_VAR_ARG7

#define DIF_VAR_ARG7 0x010d
eighth argument

macroDIF_VAR_ARG8

#define DIF_VAR_ARG8 0x010e
ninth argument

macroDIF_VAR_ARG9

#define DIF_VAR_ARG9 0x010f
tenth argument

macroDIF_VAR_STACKDEPTH

#define DIF_VAR_STACKDEPTH 0x0110
stack depth

macroDIF_VAR_CALLER

#define DIF_VAR_CALLER 0x0111
caller

macroDIF_VAR_PROBEPROV

#define DIF_VAR_PROBEPROV 0x0112
probe provider

macroDIF_VAR_PROBEMOD

#define DIF_VAR_PROBEMOD 0x0113
probe module

macroDIF_VAR_PROBEFUNC

#define DIF_VAR_PROBEFUNC 0x0114
probe function

macroDIF_VAR_PROBENAME

#define DIF_VAR_PROBENAME 0x0115
probe name

macroDIF_VAR_PID

#define DIF_VAR_PID 0x0116
process ID

macroDIF_VAR_TID

#define DIF_VAR_TID 0x0117
(per-process) thread ID

macroDIF_VAR_EXECNAME

#define DIF_VAR_EXECNAME 0x0118
name of executable

macroDIF_VAR_ZONENAME

#define DIF_VAR_ZONENAME 0x0119
zone name associated with process

macroDIF_VAR_WALLTIMESTAMP

#define DIF_VAR_WALLTIMESTAMP 0x011a
wall-clock timestamp

macroDIF_VAR_USTACKDEPTH

#define DIF_VAR_USTACKDEPTH 0x011b
user-land stack depth

macroDIF_VAR_UCALLER

#define DIF_VAR_UCALLER 0x011c
user-level caller

macroDIF_VAR_PPID

#define DIF_VAR_PPID 0x011d
parent process ID

macroDIF_VAR_UID

#define DIF_VAR_UID 0x011e
process user ID

macroDIF_VAR_GID

#define DIF_VAR_GID 0x011f
process group ID

macroDIF_VAR_ERRNO

#define DIF_VAR_ERRNO 0x0120
thread errno

macroDIF_VAR_PTHREAD_SELF

#define DIF_VAR_PTHREAD_SELF 0x0200
Apple specific PTHREAD_SELF (Not currently supported!)

macroDIF_VAR_DISPATCHQADDR

#define DIF_VAR_DISPATCHQADDR 0x0201
Apple specific dispatch queue addr

macroDIF_VAR_MACHTIMESTAMP

#define DIF_VAR_MACHTIMESTAMP 0x0202

macroDIF_VAR_CPU

#define DIF_VAR_CPU 0x0203
cpu number

macroDIF_VAR_CPUINSTRS

#define DIF_VAR_CPUINSTRS 0x0204
cpu instructions

macroDIF_VAR_CPUCYCLES

#define DIF_VAR_CPUCYCLES 0x0205
cpu cycles

macroDIF_VAR_VINSTRS

#define DIF_VAR_VINSTRS 0x0206
virtual instructions

macroDIF_VAR_VCYCLES

#define DIF_VAR_VCYCLES 0x0207
virtual cycles

macroDIF_VAR_MACHCTIMESTAMP

#define DIF_VAR_MACHCTIMESTAMP 0x0208

macroDIF_SUBR_RAND

#define DIF_SUBR_RAND 0

macroDIF_SUBR_MUTEX_OWNED

#define DIF_SUBR_MUTEX_OWNED 1

macroDIF_SUBR_MUTEX_OWNER

#define DIF_SUBR_MUTEX_OWNER 2

macroDIF_SUBR_MUTEX_TYPE_ADAPTIVE

#define DIF_SUBR_MUTEX_TYPE_ADAPTIVE 3

macroDIF_SUBR_MUTEX_TYPE_SPIN

#define DIF_SUBR_MUTEX_TYPE_SPIN 4

macroDIF_SUBR_RW_READ_HELD

#define DIF_SUBR_RW_READ_HELD 5

macroDIF_SUBR_RW_WRITE_HELD

#define DIF_SUBR_RW_WRITE_HELD 6

macroDIF_SUBR_RW_ISWRITER

#define DIF_SUBR_RW_ISWRITER 7

macroDIF_SUBR_COPYIN

#define DIF_SUBR_COPYIN 8

macroDIF_SUBR_COPYINSTR

#define DIF_SUBR_COPYINSTR 9

macroDIF_SUBR_SPECULATION

#define DIF_SUBR_SPECULATION 10

macroDIF_SUBR_PROGENYOF

#define DIF_SUBR_PROGENYOF 11

macroDIF_SUBR_STRLEN

#define DIF_SUBR_STRLEN 12

macroDIF_SUBR_COPYOUT

#define DIF_SUBR_COPYOUT 13

macroDIF_SUBR_COPYOUTSTR

#define DIF_SUBR_COPYOUTSTR 14

macroDIF_SUBR_ALLOCA

#define DIF_SUBR_ALLOCA 15

macroDIF_SUBR_BCOPY

#define DIF_SUBR_BCOPY 16

macroDIF_SUBR_COPYINTO

#define DIF_SUBR_COPYINTO 17

macroDIF_SUBR_MSGDSIZE

#define DIF_SUBR_MSGDSIZE 18

macroDIF_SUBR_MSGSIZE

#define DIF_SUBR_MSGSIZE 19

macroDIF_SUBR_GETMAJOR

#define DIF_SUBR_GETMAJOR 20

macroDIF_SUBR_GETMINOR

#define DIF_SUBR_GETMINOR 21

macroDIF_SUBR_DDI_PATHNAME

#define DIF_SUBR_DDI_PATHNAME 22

macroDIF_SUBR_STRJOIN

#define DIF_SUBR_STRJOIN 23

macroDIF_SUBR_LLTOSTR

#define DIF_SUBR_LLTOSTR 24

macroDIF_SUBR_BASENAME

#define DIF_SUBR_BASENAME 25

macroDIF_SUBR_DIRNAME

#define DIF_SUBR_DIRNAME 26

macroDIF_SUBR_CLEANPATH

#define DIF_SUBR_CLEANPATH 27

macroDIF_SUBR_STRCHR

#define DIF_SUBR_STRCHR 28

macroDIF_SUBR_STRRCHR

#define DIF_SUBR_STRRCHR 29

macroDIF_SUBR_STRSTR

#define DIF_SUBR_STRSTR 30

macroDIF_SUBR_STRTOK

#define DIF_SUBR_STRTOK 31

macroDIF_SUBR_SUBSTR

#define DIF_SUBR_SUBSTR 32

macroDIF_SUBR_INDEX

#define DIF_SUBR_INDEX 33

macroDIF_SUBR_RINDEX

#define DIF_SUBR_RINDEX 34

macroDIF_SUBR_HTONS

#define DIF_SUBR_HTONS 35

macroDIF_SUBR_HTONL

#define DIF_SUBR_HTONL 36

macroDIF_SUBR_HTONLL

#define DIF_SUBR_HTONLL 37

macroDIF_SUBR_NTOHS

#define DIF_SUBR_NTOHS 38

macroDIF_SUBR_NTOHL

#define DIF_SUBR_NTOHL 39

macroDIF_SUBR_NTOHLL

#define DIF_SUBR_NTOHLL 40

macroDIF_SUBR_INET_NTOP

#define DIF_SUBR_INET_NTOP 41

macroDIF_SUBR_INET_NTOA

#define DIF_SUBR_INET_NTOA 42

macroDIF_SUBR_INET_NTOA6

#define DIF_SUBR_INET_NTOA6 43

macroDIF_SUBR_TOUPPER

#define DIF_SUBR_TOUPPER 44

macroDIF_SUBR_TOLOWER

#define DIF_SUBR_TOLOWER 45

macroDIF_SUBR_JSON

#define DIF_SUBR_JSON 46

macroDIF_SUBR_STRTOLL

#define DIF_SUBR_STRTOLL 47

macroDIF_SUBR_STRIP

#define DIF_SUBR_STRIP 48

macroDIF_SUBR_MAX

#define DIF_SUBR_MAX 48
max subroutine value

macroDIF_SUBR_APPLE_MIN

Apple-specific subroutines
#define DIF_SUBR_APPLE_MIN 200
min apple-specific subroutine value

macroDIF_SUBR_VM_KERNEL_ADDRPERM

#define DIF_SUBR_VM_KERNEL_ADDRPERM 200

macroDIF_SUBR_KDEBUG_TRACE

#define DIF_SUBR_KDEBUG_TRACE 201

macroDIF_SUBR_KDEBUG_TRACE_STRING

#define DIF_SUBR_KDEBUG_TRACE_STRING 202

macroDIF_SUBR_MTONS

#define DIF_SUBR_MTONS 203

macroDIF_SUBR_PHYSMEM_READ

#define DIF_SUBR_PHYSMEM_READ 204

macroDIF_SUBR_PHYSMEM_WRITE

#define DIF_SUBR_PHYSMEM_WRITE 205

macroDIF_SUBR_KVTOPHYS

#define DIF_SUBR_KVTOPHYS 206

macroDIF_SUBR_LIVEDUMP

#define DIF_SUBR_LIVEDUMP 207

macroDIF_SUBR_APPLE_MAX

#define DIF_SUBR_APPLE_MAX 207
max apple-specific subroutine value

typedefdif_instr_t

typedef uint32_t dif_instr_t

macroDIF_INSTR_OP

#define DIF_INSTR_OP(i) (((i) >> 24) & 0xff)

macroDIF_INSTR_R1

#define DIF_INSTR_R1(i) (((i) >> 16) & 0xff)

macroDIF_INSTR_R2

#define DIF_INSTR_R2(i) (((i) >>  8) & 0xff)

macroDIF_INSTR_RD

#define DIF_INSTR_RD(i) ((i) & 0xff)

macroDIF_INSTR_RS

#define DIF_INSTR_RS(i) ((i) & 0xff)

macroDIF_INSTR_IMM2

#define DIF_INSTR_IMM2(i) (((i) >>  8) & 0xff)

macroDIF_INSTR_LABEL

#define DIF_INSTR_LABEL(i) ((i) & 0xffffff)

macroDIF_INSTR_VAR

#define DIF_INSTR_VAR(i) (((i) >>  8) & 0xffff)

macroDIF_INSTR_INTEGER

#define DIF_INSTR_INTEGER(i) (((i) >>  8) & 0xffff)

macroDIF_INSTR_STRING

#define DIF_INSTR_STRING(i) (((i) >>  8) & 0xffff)

macroDIF_INSTR_SUBR

#define DIF_INSTR_SUBR(i) (((i) >>  8) & 0xffff)

macroDIF_INSTR_TYPE

#define DIF_INSTR_TYPE(i) (((i) >> 16) & 0xff)

macroDIF_INSTR_XLREF

#define DIF_INSTR_XLREF(i) (((i) >>  8) & 0xffff)

macroDIF_INSTR_FMT

#define DIF_INSTR_FMT(op, r1, r2, d) (((op) << 24) | ((r1) << 16) | ((r2) << 8) | (d))

macroDIF_INSTR_NOT

#define DIF_INSTR_NOT(r1, d) (DIF_INSTR_FMT(DIF_OP_NOT, r1, 0, d))

macroDIF_INSTR_MOV

#define DIF_INSTR_MOV(r1, d) (DIF_INSTR_FMT(DIF_OP_MOV, r1, 0, d))

macroDIF_INSTR_CMP

#define DIF_INSTR_CMP(op, r1, r2) (DIF_INSTR_FMT(op, r1, r2, 0))

macroDIF_INSTR_TST

#define DIF_INSTR_TST(r1) (DIF_INSTR_FMT(DIF_OP_TST, r1, 0, 0))

macroDIF_INSTR_BRANCH

#define DIF_INSTR_BRANCH(op, label) (((op) << 24) | (label))

macroDIF_INSTR_LOAD

#define DIF_INSTR_LOAD(op, r1, d) (DIF_INSTR_FMT(op, r1, 0, d))

macroDIF_INSTR_STORE

#define DIF_INSTR_STORE(op, r1, d) (DIF_INSTR_FMT(op, r1, 0, d))

macroDIF_INSTR_SETX

#define DIF_INSTR_SETX(i, d) ((DIF_OP_SETX << 24) | ((i) << 8) | (d))

macroDIF_INSTR_SETS

#define DIF_INSTR_SETS(s, d) ((DIF_OP_SETS << 24) | ((s) << 8) | (d))

macroDIF_INSTR_RET

#define DIF_INSTR_RET(d) (DIF_INSTR_FMT(DIF_OP_RET, 0, 0, d))

macroDIF_INSTR_NOP

#define DIF_INSTR_NOP (DIF_OP_NOP << 24)

macroDIF_INSTR_LDA

#define DIF_INSTR_LDA(op, v, r, d) (DIF_INSTR_FMT(op, v, r, d))

macroDIF_INSTR_LDV

#define DIF_INSTR_LDV(op, v, d) (((op) << 24) | ((v) << 8) | (d))

macroDIF_INSTR_STV

#define DIF_INSTR_STV(op, v, rs) (((op) << 24) | ((v) << 8) | (rs))

macroDIF_INSTR_CALL

#define DIF_INSTR_CALL(s, d) ((DIF_OP_CALL << 24) | ((s) << 8) | (d))

macroDIF_INSTR_PUSHTS

#define DIF_INSTR_PUSHTS(op, t, r2, rs) (DIF_INSTR_FMT(op, t, r2, rs))

macroDIF_INSTR_POPTS

#define DIF_INSTR_POPTS (DIF_OP_POPTS << 24)

macroDIF_INSTR_FLUSHTS

#define DIF_INSTR_FLUSHTS (DIF_OP_FLUSHTS << 24)

macroDIF_INSTR_ALLOCS

#define DIF_INSTR_ALLOCS(r1, d) (DIF_INSTR_FMT(DIF_OP_ALLOCS, r1, 0, d))

macroDIF_INSTR_COPYS

#define DIF_INSTR_COPYS(r1, r2, d) (DIF_INSTR_FMT(DIF_OP_COPYS, r1, r2, d))

macroDIF_INSTR_XLATE

#define DIF_INSTR_XLATE(op, r, d) (((op) << 24) | ((r) << 8) | (d))

macroDIF_REG_R0

#define DIF_REG_R0 0
%r0 is always set to zero

structdtrace_diftype

A DTrace Intermediate Format Type (DIF Type) is used to represent the types of variables, function and associative array arguments, and the return type for each DIF object (shown below). It contains a description of the type, its size in bytes, and a module identifier.
size 8, align 4
uint8_tdtdt_kindtype kind (see below)
uint8_tdtdt_ckindtype kind in CTF
uint8_tdtdt_flagstype flags (see below)
uint8_tdtdt_padreserved for future use
uint32_tdtdt_sizetype size in bytes (unless string)

typedefdtrace_diftype_t

typedef struct dtrace_diftype dtrace_diftype_t;

macroDIF_TYPE_CTF

#define DIF_TYPE_CTF 0
type is a CTF type

macroDIF_TYPE_STRING

#define DIF_TYPE_STRING 1
type is a D string

macroDIF_TF_BYREF

#define DIF_TF_BYREF 0x1
type is passed by reference

macroDIF_TF_BYUREF

#define DIF_TF_BYUREF 0x2
user type is passed by reference

structdtrace_difv

A DTrace Intermediate Format variable record is used to describe each of the variables referenced by a given DIF object. It contains an integer variable identifier along with variable scope and properties, as shown below. The size of this structure must be sizeof (int) aligned.
size 20, align 4
uint32_tdtdv_namevariable name index in dtdo_strtab
uint32_tdtdv_idvariable reference identifier
uint8_tdtdv_kindvariable kind (see below)
uint8_tdtdv_scopevariable scope (see below)
uint16_tdtdv_flagsvariable flags (see below)
dtrace_diftype_tdtdv_typevariable type (see above)

typedefdtrace_difv_t

typedef struct dtrace_difv dtrace_difv_t;

macroDIFV_KIND_ARRAY

#define DIFV_KIND_ARRAY 0
variable is an array of quantities

macroDIFV_KIND_SCALAR

#define DIFV_KIND_SCALAR 1
variable is a scalar quantity

macroDIFV_SCOPE_GLOBAL

#define DIFV_SCOPE_GLOBAL 0
variable has global scope

macroDIFV_SCOPE_THREAD

#define DIFV_SCOPE_THREAD 1
variable has thread scope

macroDIFV_SCOPE_LOCAL

#define DIFV_SCOPE_LOCAL 2
variable has local scope

macroDIFV_F_REF

#define DIFV_F_REF 0x1
variable is referenced by DIFO

macroDIFV_F_MOD

#define DIFV_F_MOD 0x2
variable is written by DIFO

macroDTRACEACT_NONE

DTrace Actions The upper byte determines the class of the action; the low bytes determines the specific action within that class. The classes of actions are as follows: [ no class ] <= May record process- or kernel-related data DTRACEACT_PROC <= Only records process-related data DTRACEACT_PROC_DESTRUCTIVE <= Potentially destructive to processes DTRACEACT_KERNEL <= Only records kernel-related data DTRACEACT_KERNEL_DESTRUCTIVE <= Potentially destructive to the kernel DTRACEACT_SPECULATIVE <= Speculation-related action DTRACEACT_AGGREGATION <= Aggregating action
#define DTRACEACT_NONE 0
no action

macroDTRACEACT_DIFEXPR

#define DTRACEACT_DIFEXPR 1
action is DIF expression

macroDTRACEACT_EXIT

#define DTRACEACT_EXIT 2
exit() action

macroDTRACEACT_PRINTF

#define DTRACEACT_PRINTF 3
printf() action

macroDTRACEACT_PRINTA

#define DTRACEACT_PRINTA 4
printa() action

macroDTRACEACT_LIBACT

#define DTRACEACT_LIBACT 5
library-controlled action

macroDTRACEACT_TRACEMEM

#define DTRACEACT_TRACEMEM 6
tracemem() action

macroDTRACEACT_TRACEMEM_DYNSIZE

#define DTRACEACT_TRACEMEM_DYNSIZE 7
dynamic tracemem() size

macroDTRACEACT_APPLEBINARY

#define DTRACEACT_APPLEBINARY 50
Apple DT perf. tool action

macroDTRACEACT_PROC

#define DTRACEACT_PROC 0x0100

macroDTRACEACT_USTACK

#define DTRACEACT_USTACK (DTRACEACT_PROC + 1)

macroDTRACEACT_JSTACK

#define DTRACEACT_JSTACK (DTRACEACT_PROC + 2)

macroDTRACEACT_USYM

#define DTRACEACT_USYM (DTRACEACT_PROC + 3)

macroDTRACEACT_UMOD

#define DTRACEACT_UMOD (DTRACEACT_PROC + 4)

macroDTRACEACT_UADDR

#define DTRACEACT_UADDR (DTRACEACT_PROC + 5)

macroDTRACEACT_PROC_DESTRUCTIVE

#define DTRACEACT_PROC_DESTRUCTIVE 0x0200

macroDTRACEACT_STOP

#define DTRACEACT_STOP (DTRACEACT_PROC_DESTRUCTIVE + 1)

macroDTRACEACT_RAISE

#define DTRACEACT_RAISE (DTRACEACT_PROC_DESTRUCTIVE + 2)

macroDTRACEACT_SYSTEM

#define DTRACEACT_SYSTEM (DTRACEACT_PROC_DESTRUCTIVE + 3)

macroDTRACEACT_FREOPEN

#define DTRACEACT_FREOPEN (DTRACEACT_PROC_DESTRUCTIVE + 4)

macroDTRACEACT_PIDRESUME

#define DTRACEACT_PIDRESUME (DTRACEACT_PROC_DESTRUCTIVE + 50)

macroDTRACEACT_PROC_CONTROL

#define DTRACEACT_PROC_CONTROL 0x0300

macroDTRACEACT_KERNEL

#define DTRACEACT_KERNEL 0x0400

macroDTRACEACT_STACK

#define DTRACEACT_STACK (DTRACEACT_KERNEL + 1)

macroDTRACEACT_SYM

#define DTRACEACT_SYM (DTRACEACT_KERNEL + 2)

macroDTRACEACT_MOD

#define DTRACEACT_MOD (DTRACEACT_KERNEL + 3)

macroDTRACEACT_KERNEL_DESTRUCTIVE

#define DTRACEACT_KERNEL_DESTRUCTIVE 0x0500

macroDTRACEACT_BREAKPOINT

#define DTRACEACT_BREAKPOINT (DTRACEACT_KERNEL_DESTRUCTIVE + 1)

macroDTRACEACT_PANIC

#define DTRACEACT_PANIC (DTRACEACT_KERNEL_DESTRUCTIVE + 2)

macroDTRACEACT_CHILL

#define DTRACEACT_CHILL (DTRACEACT_KERNEL_DESTRUCTIVE + 3)

macroDTRACEACT_SPECULATIVE

#define DTRACEACT_SPECULATIVE 0x0600

macroDTRACEACT_SPECULATE

#define DTRACEACT_SPECULATE (DTRACEACT_SPECULATIVE + 1)

macroDTRACEACT_COMMIT

#define DTRACEACT_COMMIT (DTRACEACT_SPECULATIVE + 2)

macroDTRACEACT_DISCARD

#define DTRACEACT_DISCARD (DTRACEACT_SPECULATIVE + 3)

macroDTRACEACT_CLASS

#define DTRACEACT_CLASS(x) ((x) & 0xff00)

macroDTRACEACT_ISSPECULATIVE

#define DTRACEACT_ISSPECULATIVE(x) (DTRACEACT_CLASS(x) == DTRACEACT_SPECULATIVE)

macroDTRACEACT_ISPRINTFLIKE

#define DTRACEACT_ISPRINTFLIKE(x) ((x) == DTRACEACT_PRINTF || (x) == DTRACEACT_PRINTA ||
        (x) == DTRACEACT_SYSTEM || (x) == DTRACEACT_FREOPEN)

macroDTRACEACT_AGGREGATION

DTrace Aggregating Actions These are functions f(x) for which the following is true: f(f(x_0) U f(x_1) U ... U f(x_n)) = f(x_0 U x_1 U ... U x_n) where x_n is a set of arbitrary data. Aggregating actions are in their own DTrace action class, DTTRACEACT_AGGREGATION. The macros provided here allow for easier processing of the aggregation argument and data payload for a few aggregating actions (notably: quantize(), lquantize(), and ustack()).
#define DTRACEACT_AGGREGATION 0x0700

macroDTRACEAGG_COUNT

#define DTRACEAGG_COUNT (DTRACEACT_AGGREGATION + 1)

macroDTRACEAGG_MIN

#define DTRACEAGG_MIN (DTRACEACT_AGGREGATION + 2)

macroDTRACEAGG_MAX

#define DTRACEAGG_MAX (DTRACEACT_AGGREGATION + 3)

macroDTRACEAGG_AVG

#define DTRACEAGG_AVG (DTRACEACT_AGGREGATION + 4)

macroDTRACEAGG_SUM

#define DTRACEAGG_SUM (DTRACEACT_AGGREGATION + 5)

macroDTRACEAGG_STDDEV

#define DTRACEAGG_STDDEV (DTRACEACT_AGGREGATION + 6)

macroDTRACEAGG_QUANTIZE

#define DTRACEAGG_QUANTIZE (DTRACEACT_AGGREGATION + 7)

macroDTRACEAGG_LQUANTIZE

#define DTRACEAGG_LQUANTIZE (DTRACEACT_AGGREGATION + 8)

macroDTRACEAGG_LLQUANTIZE

#define DTRACEAGG_LLQUANTIZE (DTRACEACT_AGGREGATION + 9)

macroDTRACEACT_ISAGG

#define DTRACEACT_ISAGG(x) (DTRACEACT_CLASS(x) == DTRACEACT_AGGREGATION)

macroDTRACE_QUANTIZE_NBUCKETS

#define DTRACE_QUANTIZE_NBUCKETS (int)(((sizeof (uint64_t) * NBBY) - 1) * 2 + 1)

macroDTRACE_QUANTIZE_ZEROBUCKET

#define DTRACE_QUANTIZE_ZEROBUCKET (int64_t)((sizeof (uint64_t) * NBBY) - 1)

macroDTRACE_QUANTIZE_BUCKETVAL

#define DTRACE_QUANTIZE_BUCKETVAL(buck) (int64_t)((buck) < DTRACE_QUANTIZE_ZEROBUCKET ?
        -(1LL << (DTRACE_QUANTIZE_ZEROBUCKET - 1 - (buck))) :
        (buck) == DTRACE_QUANTIZE_ZEROBUCKET ? 0 :
        1LL << ((buck) - DTRACE_QUANTIZE_ZEROBUCKET - 1))

macroDTRACE_LQUANTIZE_STEPSHIFT

#define DTRACE_LQUANTIZE_STEPSHIFT 48

macroDTRACE_LQUANTIZE_STEPMASK

#define DTRACE_LQUANTIZE_STEPMASK ((uint64_t)UINT16_MAX << 48)

macroDTRACE_LQUANTIZE_LEVELSHIFT

#define DTRACE_LQUANTIZE_LEVELSHIFT 32

macroDTRACE_LQUANTIZE_LEVELMASK

#define DTRACE_LQUANTIZE_LEVELMASK ((uint64_t)UINT16_MAX << 32)

macroDTRACE_LQUANTIZE_BASESHIFT

#define DTRACE_LQUANTIZE_BASESHIFT 0

macroDTRACE_LQUANTIZE_BASEMASK

#define DTRACE_LQUANTIZE_BASEMASK UINT32_MAX

macroDTRACE_LQUANTIZE_STEP

#define DTRACE_LQUANTIZE_STEP(x) (uint16_t)(((x) & DTRACE_LQUANTIZE_STEPMASK) >>
        DTRACE_LQUANTIZE_STEPSHIFT)

macroDTRACE_LQUANTIZE_LEVELS

#define DTRACE_LQUANTIZE_LEVELS(x) (uint16_t)(((x) & DTRACE_LQUANTIZE_LEVELMASK) >>
        DTRACE_LQUANTIZE_LEVELSHIFT)

macroDTRACE_LQUANTIZE_BASE

#define DTRACE_LQUANTIZE_BASE(x) (int32_t)(((x) & DTRACE_LQUANTIZE_BASEMASK) >>
        DTRACE_LQUANTIZE_BASESHIFT)

macroDTRACE_LLQUANTIZE_FACTORSHIFT

#define DTRACE_LLQUANTIZE_FACTORSHIFT 48

macroDTRACE_LLQUANTIZE_FACTORMASK

#define DTRACE_LLQUANTIZE_FACTORMASK ((uint64_t)UINT16_MAX << 48)

macroDTRACE_LLQUANTIZE_LOWSHIFT

#define DTRACE_LLQUANTIZE_LOWSHIFT 32

macroDTRACE_LLQUANTIZE_LOWMASK

#define DTRACE_LLQUANTIZE_LOWMASK ((uint64_t)UINT16_MAX << 32)

macroDTRACE_LLQUANTIZE_HIGHSHIFT

#define DTRACE_LLQUANTIZE_HIGHSHIFT 16

macroDTRACE_LLQUANTIZE_HIGHMASK

#define DTRACE_LLQUANTIZE_HIGHMASK ((uint64_t)UINT16_MAX << 16)

macroDTRACE_LLQUANTIZE_NSTEPSHIFT

#define DTRACE_LLQUANTIZE_NSTEPSHIFT 0

macroDTRACE_LLQUANTIZE_NSTEPMASK

#define DTRACE_LLQUANTIZE_NSTEPMASK UINT16_MAX

macroDTRACE_LLQUANTIZE_FACTOR

#define DTRACE_LLQUANTIZE_FACTOR(x) (uint16_t)(((x) & DTRACE_LLQUANTIZE_FACTORMASK) >>
        DTRACE_LLQUANTIZE_FACTORSHIFT)

macroDTRACE_LLQUANTIZE_LOW

#define DTRACE_LLQUANTIZE_LOW(x) (uint16_t)(((x) & DTRACE_LLQUANTIZE_LOWMASK) >>
        DTRACE_LLQUANTIZE_LOWSHIFT)

macroDTRACE_LLQUANTIZE_HIGH

#define DTRACE_LLQUANTIZE_HIGH(x) (uint16_t)(((x) & DTRACE_LLQUANTIZE_HIGHMASK) >>
        DTRACE_LLQUANTIZE_HIGHSHIFT)

macroDTRACE_LLQUANTIZE_NSTEP

#define DTRACE_LLQUANTIZE_NSTEP(x) (uint16_t)(((x) & DTRACE_LLQUANTIZE_NSTEPMASK) >>
        DTRACE_LLQUANTIZE_NSTEPSHIFT)

macroDTRACE_USTACK_NFRAMES

#define DTRACE_USTACK_NFRAMES(x) (uint32_t)((x) & UINT32_MAX)

macroDTRACE_USTACK_STRSIZE

#define DTRACE_USTACK_STRSIZE(x) (uint32_t)((x) >> 32)

macroDTRACE_USTACK_ARG

#define DTRACE_USTACK_ARG(x, y) ((((uint64_t)(y)) << 32) | ((x) & UINT32_MAX))

macroDTRACE_PTR

#define DTRACE_PTR(type, name) type *name

macroDOF_ID_SIZE

#define DOF_ID_SIZE 16
total size of dofh_ident[] in bytes

structdof_hdr

size 64, align 8
uint8_t[16]dofh_identidentification bytes (see below)
uint32_tdofh_flagsfile attribute flags (if any)
uint32_tdofh_hdrsizesize of file header in bytes
uint32_tdofh_secsizesize of section header in bytes
uint32_tdofh_secnumnumber of section headers
uint64_tdofh_secofffile offset of section headers
uint64_tdofh_loadszfile size of loadable portion
uint64_tdofh_fileszfile size of entire DOF file
uint64_tdofh_padreserved for future use

typedefdof_hdr_t

typedef struct dof_hdr dof_hdr_t;

macroDOF_ID_MAG0

#define DOF_ID_MAG0 0
first byte of magic number

macroDOF_ID_MAG1

#define DOF_ID_MAG1 1
second byte of magic number

macroDOF_ID_MAG2

#define DOF_ID_MAG2 2
third byte of magic number

macroDOF_ID_MAG3

#define DOF_ID_MAG3 3
fourth byte of magic number

macroDOF_ID_MODEL

#define DOF_ID_MODEL 4
DOF data model (see below)

macroDOF_ID_ENCODING

#define DOF_ID_ENCODING 5
DOF data encoding (see below)

macroDOF_ID_VERSION

#define DOF_ID_VERSION 6
DOF file format major version (see below)

macroDOF_ID_DIFVERS

#define DOF_ID_DIFVERS 7
DIF instruction set version

macroDOF_ID_DIFIREG

#define DOF_ID_DIFIREG 8
DIF integer registers used by compiler

macroDOF_ID_DIFTREG

#define DOF_ID_DIFTREG 9
DIF tuple registers used by compiler

macroDOF_ID_PAD

#define DOF_ID_PAD 10
start of padding bytes (all zeroes)

macroDOF_MAG_MAG0

#define DOF_MAG_MAG0 0x7F
DOF_ID_MAG[0-3]

macroDOF_MAG_MAG1

#define DOF_MAG_MAG1 'D'

macroDOF_MAG_MAG2

#define DOF_MAG_MAG2 'O'

macroDOF_MAG_MAG3

#define DOF_MAG_MAG3 'F'

macroDOF_MAG_STRING

#define DOF_MAG_STRING "\177DOF"

macroDOF_MAG_STRLEN

#define DOF_MAG_STRLEN 4

macroDOF_MODEL_NONE

#define DOF_MODEL_NONE 0

macroDOF_MODEL_ILP32

#define DOF_MODEL_ILP32 1

macroDOF_MODEL_LP64

#define DOF_MODEL_LP64 2

macroDOF_MODEL_NATIVE

#define DOF_MODEL_NATIVE DOF_MODEL_LP64

macroDOF_ENCODE_NONE

#define DOF_ENCODE_NONE 0

macroDOF_ENCODE_LSB

#define DOF_ENCODE_LSB 1

macroDOF_ENCODE_MSB

#define DOF_ENCODE_MSB 2

macroDOF_ENCODE_NATIVE

#define DOF_ENCODE_NATIVE DOF_ENCODE_LSB

macroDOF_VERSION_1

#define DOF_VERSION_1 1
DOF version 1: Solaris 10 FCS

macroDOF_VERSION_2

#define DOF_VERSION_2 2
DOF version 2: Solaris Express 6/06

macroDOF_VERSION_3

#define DOF_VERSION_3 3
DOF version 3: Minimum version for Leopard

macroDOF_VERSION

#define DOF_VERSION DOF_VERSION_3
Latest DOF version

macroDOF_FL_VALID

#define DOF_FL_VALID 0
mask of all valid dofh_flags bits

typedefdof_secidx_t

typedef uint32_t dof_secidx_t
section header table index type

typedefdof_stridx_t

typedef uint32_t dof_stridx_t
string table index type

macroDOF_SECIDX_NONE

#define DOF_SECIDX_NONE (-1U)
null value for section indices

macroDOF_STRIDX_NONE

#define DOF_STRIDX_NONE (-1U)
null value for string indices

structdof_sec

size 32, align 8
uint32_tdofs_typesection type (see below)
uint32_tdofs_alignsection data memory alignment
uint32_tdofs_flagssection flags (if any)
uint32_tdofs_entsizesize of section entry (if table)
uint64_tdofs_offsetoffset of section data within file
uint64_tdofs_sizesize of section data in bytes

typedefdof_sec_t

typedef struct dof_sec dof_sec_t;

macroDOF_SECT_NONE

#define DOF_SECT_NONE 0
null section

macroDOF_SECT_COMMENTS

#define DOF_SECT_COMMENTS 1
compiler comments

macroDOF_SECT_SOURCE

#define DOF_SECT_SOURCE 2
D program source code

macroDOF_SECT_ECBDESC

#define DOF_SECT_ECBDESC 3

macroDOF_SECT_PROBEDESC

#define DOF_SECT_PROBEDESC 4

macroDOF_SECT_ACTDESC

#define DOF_SECT_ACTDESC 5

macroDOF_SECT_DIFOHDR

#define DOF_SECT_DIFOHDR 6
dof_difohdr_t (variable length)

macroDOF_SECT_DIF

#define DOF_SECT_DIF 7
uint32_t array of byte code

macroDOF_SECT_STRTAB

#define DOF_SECT_STRTAB 8
string table

macroDOF_SECT_VARTAB

#define DOF_SECT_VARTAB 9

macroDOF_SECT_RELTAB

#define DOF_SECT_RELTAB 10

macroDOF_SECT_TYPTAB

#define DOF_SECT_TYPTAB 11

macroDOF_SECT_URELHDR

#define DOF_SECT_URELHDR 12
dof_relohdr_t (user relocations)

macroDOF_SECT_KRELHDR

#define DOF_SECT_KRELHDR 13
dof_relohdr_t (kernel relocations)

macroDOF_SECT_OPTDESC

#define DOF_SECT_OPTDESC 14

macroDOF_SECT_PROVIDER

#define DOF_SECT_PROVIDER 15

macroDOF_SECT_PROBES

#define DOF_SECT_PROBES 16

macroDOF_SECT_PRARGS

#define DOF_SECT_PRARGS 17
uint8_t array (probe arg mappings)

macroDOF_SECT_PROFFS

#define DOF_SECT_PROFFS 18
uint32_t array (probe arg offsets)

macroDOF_SECT_INTTAB

#define DOF_SECT_INTTAB 19
uint64_t array

macroDOF_SECT_UTSNAME

#define DOF_SECT_UTSNAME 20
struct utsname

macroDOF_SECT_XLTAB

#define DOF_SECT_XLTAB 21

macroDOF_SECT_XLMEMBERS

#define DOF_SECT_XLMEMBERS 22

macroDOF_SECT_XLIMPORT

#define DOF_SECT_XLIMPORT 23

macroDOF_SECT_XLEXPORT

#define DOF_SECT_XLEXPORT 24

macroDOF_SECT_PREXPORT

#define DOF_SECT_PREXPORT 25
dof_secidx_t array (exported objs)

macroDOF_SECT_PRENOFFS

#define DOF_SECT_PRENOFFS 26
uint32_t array (enabled offsets)

macroDOF_SECF_LOAD

#define DOF_SECF_LOAD 1
section should be loaded

structdof_ecbdesc

size 24, align 8
dof_secidx_tdofe_probeslink to DOF_SECT_PROBEDESC
dof_secidx_tdofe_predlink to DOF_SECT_DIFOHDR
dof_secidx_tdofe_actionslink to DOF_SECT_ACTDESC
uint32_tdofe_padreserved for future use
uint64_tdofe_uarguser-supplied library argument

typedefdof_ecbdesc_t

typedef struct dof_ecbdesc dof_ecbdesc_t;

structdof_probedesc

size 24, align 4
dof_secidx_tdofp_strtablink to DOF_SECT_STRTAB section
dof_stridx_tdofp_providerprovider string
dof_stridx_tdofp_modmodule string
dof_stridx_tdofp_funcfunction string
dof_stridx_tdofp_namename string
uint32_tdofp_idprobe identifier (or zero)

typedefdof_probedesc_t

typedef struct dof_probedesc dof_probedesc_t;

structdof_actdesc

size 32, align 8
dof_secidx_tdofa_difolink to DOF_SECT_DIFOHDR
dof_secidx_tdofa_strtablink to DOF_SECT_STRTAB section
uint32_tdofa_kindaction kind (DTRACEACT_* constant)
uint32_tdofa_ntuplenumber of subsequent tuple actions
uint64_tdofa_argkind-specific argument
uint64_tdofa_uarguser-supplied argument

typedefdof_actdesc_t

typedef struct dof_actdesc dof_actdesc_t;

structdof_difohdr

size 12, align 4
dtrace_diftype_tdofd_rtypereturn type for this fragment
dof_secidx_t[1]dofd_linksvariable length array of indices

typedefdof_difohdr_t

typedef struct dof_difohdr dof_difohdr_t;

structdof_relohdr

size 12, align 4
dof_secidx_tdofr_strtablink to DOF_SECT_STRTAB for names
dof_secidx_tdofr_relseclink to DOF_SECT_RELTAB for relos
dof_secidx_tdofr_tgtseclink to section we are relocating

typedefdof_relohdr_t

typedef struct dof_relohdr dof_relohdr_t;

structdof_relodesc

size 24, align 8
dof_stridx_tdofr_namestring name of relocation symbol
uint32_tdofr_typerelo type (DOF_RELO_* constant)
uint64_tdofr_offsetbyte offset for relocation
uint64_tdofr_dataadditional type-specific data

typedefdof_relodesc_t

typedef struct dof_relodesc dof_relodesc_t;

macroDOF_RELO_NONE

#define DOF_RELO_NONE 0
empty relocation entry

macroDOF_RELO_SETX

#define DOF_RELO_SETX 1
relocate setx value

structdof_optdesc

size 16, align 8
uint32_tdofo_optionoption identifier
dof_secidx_tdofo_strtabstring table, if string option
uint64_tdofo_valueoption value or string index

typedefdof_optdesc_t

typedef struct dof_optdesc dof_optdesc_t;

typedefdof_attr_t

typedef uint32_t dof_attr_t
encoded stability attributes

macroDOF_ATTR

#define DOF_ATTR(n, d, c) (((n) << 24) | ((d) << 16) | ((c) << 8))

macroDOF_ATTR_NAME

#define DOF_ATTR_NAME(a) (((a) >> 24) & 0xff)

macroDOF_ATTR_DATA

#define DOF_ATTR_DATA(a) (((a) >> 16) & 0xff)

macroDOF_ATTR_CLASS

#define DOF_ATTR_CLASS(a) (((a) >>  8) & 0xff)

structdof_provider

size 44, align 4
dof_secidx_tdofpv_strtablink to DOF_SECT_STRTAB section
dof_secidx_tdofpv_probeslink to DOF_SECT_PROBES section
dof_secidx_tdofpv_prargslink to DOF_SECT_PRARGS section
dof_secidx_tdofpv_proffslink to DOF_SECT_PROFFS section
dof_stridx_tdofpv_nameprovider name string
dof_attr_tdofpv_provattrprovider attributes
dof_attr_tdofpv_modattrmodule attributes
dof_attr_tdofpv_funcattrfunction attributes
dof_attr_tdofpv_nameattrname attributes
dof_attr_tdofpv_argsattrargs attributes
dof_secidx_tdofpv_prenoffslink to DOF_SECT_PRENOFFS section

typedefdof_provider_t

typedef struct dof_provider dof_provider_t;

structdof_probe

size 48, align 8
uint64_tdofpr_addrprobe base address or offset
dof_stridx_tdofpr_funcprobe function string
dof_stridx_tdofpr_nameprobe name string
dof_stridx_tdofpr_nargvnative argument type strings
dof_stridx_tdofpr_xargvtranslated argument type strings
uint32_tdofpr_argidxindex of first argument mapping
uint32_tdofpr_offidxindex of first offset entry
uint8_tdofpr_nargcnative argument count
uint8_tdofpr_xargctranslated argument count
uint16_tdofpr_noffsnumber of offset entries for probe
uint32_tdofpr_enoffidxindex of first is-enabled offset
uint16_tdofpr_nenoffsnumber of is-enabled offsets
uint16_tdofpr_pad1reserved for future use
uint32_tdofpr_pad2reserved for future use

typedefdof_probe_t

typedef struct dof_probe dof_probe_t;

structdof_xlator

size 24, align 4
dof_secidx_tdofxl_memberslink to DOF_SECT_XLMEMBERS section
dof_secidx_tdofxl_strtablink to DOF_SECT_STRTAB section
dof_stridx_tdofxl_argvinput parameter type strings
uint32_tdofxl_argcinput parameter list length
dof_stridx_tdofxl_typeoutput type string name
dof_attr_tdofxl_attroutput stability attributes

typedefdof_xlator_t

typedef struct dof_xlator dof_xlator_t;

structdof_xlmember

size 16, align 4
dof_secidx_tdofxm_difomember link to DOF_SECT_DIFOHDR
dof_stridx_tdofxm_namemember name
dtrace_diftype_tdofxm_typemember type

typedefdof_xlmember_t

typedef struct dof_xlmember dof_xlmember_t;

structdof_xlref

size 12, align 4
dof_secidx_tdofxr_xlatorlink to DOF_SECT_XLATORS section
uint32_tdofxr_memberindex of referenced dof_xlmember
uint32_tdofxr_argnindex of argument for DIF_OP_XLARG

typedefdof_xlref_t

typedef struct dof_xlref dof_xlref_t;

structdtrace_difo

DTrace Intermediate Format Object (DIFO) A DIFO is used to store the compiled DIF for a D expression, its return type, and its string and variable tables. The string table is a single buffer of character data into which sets instructions and variable references can reference strings using a byte offset. The variable table is an array of dtrace_difv_t structures that describe the name and type of each variable and the id used in the DIF code. This structure is described above in the DIF section of this header file. The DIFO is used at both user-level (in the library) and in the kernel, but the structure is never passed between the two: the DOF structures form the only interface. As a result, the definition can change depending on the presence of _KERNEL.
size 104, align 8
dif_instr_t *dtdo_bufinstruction buffer
uint64_t *dtdo_inttabinteger table (optional)
char *dtdo_strtabstring table (optional)
dtrace_difv_t *dtdo_vartabvariable table (optional)
uint_tdtdo_lenlength of instruction buffer
uint_tdtdo_intlenlength of integer table
uint_tdtdo_strlenlength of string table
uint_tdtdo_varlenlength of variable table
dtrace_diftype_tdtdo_rtypereturn type
uint_tdtdo_refcntowner reference count
uint_tdtdo_destructiveinvokes destructive subroutines
dof_relodesc_t *dtdo_kreltabkernel relocations
dof_relodesc_t *dtdo_ureltabuser relocations
struct dt_node **dtdo_xlmtabtranslator references
uint_tdtdo_krelenlength of krelo table
uint_tdtdo_urelenlength of urelo table
uint_tdtdo_xlmlenlength of translator table

typedefdtrace_difo_t

typedef struct dtrace_difo dtrace_difo_t;

structdtrace_probedesc

size 324, align 4
dtrace_id_tdtpd_idprobe identifier
char[64]dtpd_providerprobe provider name
char[64]dtpd_modprobe module name
char[128]dtpd_funcprobe function name
char[64]dtpd_nameprobe name

typedefdtrace_probedesc_t

typedef struct dtrace_probedesc dtrace_probedesc_t;

structdtrace_repldesc

size 648, align 4
dtrace_probedesc_tdtrpd_matchprobe descr. to match
dtrace_probedesc_tdtrpd_createprobe descr. to create

typedefdtrace_repldesc_t

typedef struct dtrace_repldesc dtrace_repldesc_t;

structdtrace_preddesc

size 16, align 8
dtrace_difo_t *dtpdd_difopointer to DIF object
struct dtrace_predicate *dtpdd_predicatepointer to predicate

typedefdtrace_preddesc_t

typedef struct dtrace_preddesc dtrace_preddesc_t;

structdtrace_actdesc

size 48, align 8
dtrace_difo_t *dtad_difopointer to DIF object
struct dtrace_actdesc *dtad_nextnext action
dtrace_actkind_tdtad_kindkind of action
uint32_tdtad_ntuplenumber in tuple
uint64_tdtad_argaction argument
uint64_tdtad_uarguser argument
intdtad_refcntreference count

typedefdtrace_actdesc_t

typedef struct dtrace_actdesc dtrace_actdesc_t;

structdtrace_ecbdesc

size 376, align 8
dtrace_actdesc_t *dted_actionaction description(s)
dtrace_preddesc_tdted_predpredicate description
dtrace_probedesc_tdted_probeprobe description
uint64_tdted_uarglibrary argument
intdted_refcntreference count
uint64_tdted_probegenmatched probe generation

typedefdtrace_ecbdesc_t

typedef struct dtrace_ecbdesc dtrace_ecbdesc_t;

structdtrace_recdesc

DTrace Metadata Description Structures DTrace separates the trace data stream from the metadata stream. The only metadata tokens placed in the data stream are the dtrace_rechdr_t (EPID + timestamp) or (in the case of aggregations) aggregation identifiers. To determine the structure of the data, DTrace consumers pass the token to the kernel, and receive in return a corresponding description of the enabled probe (via the dtrace_eprobedesc structure) or the aggregation (via the dtrace_aggdesc structure). Both of these structures are expressed in terms of record descriptions (via the dtrace_recdesc structure) that describe the exact structure of the data. Some record descriptions may also contain a format identifier; this additional bit of metadata can be retrieved from the kernel, for which a format description is returned via the dtrace_fmtdesc structure. Note that all four of these structures must be bitness-neutral to allow for a 32-bit DTrace consumer on a 64-bit kernel.
size 32, align 8
dtrace_actkind_tdtrd_actionkind of action
uint32_tdtrd_sizesize of record
uint32_tdtrd_offsetoffset in ECB's data
uint16_tdtrd_alignmentrequired alignment
uint16_tdtrd_formatformat, if any
uint64_tdtrd_argaction argument
uint64_tdtrd_uarguser argument

typedefdtrace_recdesc_t

typedef struct dtrace_recdesc dtrace_recdesc_t;

structdtrace_eprobedesc

size 56, align 8
dtrace_epid_tdtepd_epidenabled probe ID
dtrace_id_tdtepd_probeidprobe ID
uint64_tdtepd_uarglibrary argument
uint32_tdtepd_sizetotal size
intdtepd_nrecsnumber of records
dtrace_recdesc_t[1]dtepd_recrecords themselves

typedefdtrace_eprobedesc_t

typedef struct dtrace_eprobedesc dtrace_eprobedesc_t;

structdtrace_aggdesc

size 72, align 8
char *dtagd_namenot filled in by kernel
dtrace_aggvarid_tdtagd_varidnot filled in by kernel
intdtagd_flagsnot filled in by kernel
dtrace_aggid_tdtagd_idaggregation ID
dtrace_epid_tdtagd_epidenabled probe ID
uint32_tdtagd_sizesize in bytes
intdtagd_nrecsnumber of records
uint32_tdtagd_padexplicit padding
dtrace_recdesc_t[1]dtagd_recrecord descriptions

typedefdtrace_aggdesc_t

typedef struct dtrace_aggdesc dtrace_aggdesc_t;

structdtrace_fmtdesc

size 16, align 8
char *dtfd_stringformat string
intdtfd_lengthlength of format string
uint16_tdtfd_formatformat identifier

typedefdtrace_fmtdesc_t

typedef struct dtrace_fmtdesc dtrace_fmtdesc_t;

macroDTRACE_SIZEOF_EPROBEDESC

#define DTRACE_SIZEOF_EPROBEDESC(desc) (sizeof (dtrace_eprobedesc_t) + ((desc)->dtepd_nrecs ?
        (((desc)->dtepd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))

macroDTRACE_SIZEOF_AGGDESC

#define DTRACE_SIZEOF_AGGDESC(desc) (sizeof (dtrace_aggdesc_t) + ((desc)->dtagd_nrecs ?
        (((desc)->dtagd_nrecs - 1) * sizeof (dtrace_recdesc_t)) : 0))

macroDTRACEOPT_BUFSIZE

DTrace Option Interface Run-time DTrace options are set and retrieved via DOF_SECT_OPTDESC sections in a DOF image. The dof_optdesc structure contains an option identifier and an option value. The valid option identifiers are found below; the mapping between option identifiers and option identifying strings is maintained at user-level. Note that the value of DTRACEOPT_UNSET is such that all of the following are potentially valid option values: all positive integers, zero and negative one. Some options (notably "bufpolicy" and "bufresize") take predefined tokens as their values; these are defined with DTRACEOPT_{option}_{token}.
#define DTRACEOPT_BUFSIZE 0
buffer size

macroDTRACEOPT_BUFPOLICY

#define DTRACEOPT_BUFPOLICY 1
buffer policy

macroDTRACEOPT_DYNVARSIZE

#define DTRACEOPT_DYNVARSIZE 2
dynamic variable size

macroDTRACEOPT_AGGSIZE

#define DTRACEOPT_AGGSIZE 3
aggregation size

macroDTRACEOPT_SPECSIZE

#define DTRACEOPT_SPECSIZE 4
speculation size

macroDTRACEOPT_NSPEC

#define DTRACEOPT_NSPEC 5
number of speculations

macroDTRACEOPT_STRSIZE

#define DTRACEOPT_STRSIZE 6
string size

macroDTRACEOPT_CLEANRATE

#define DTRACEOPT_CLEANRATE 7
dynvar cleaning rate

macroDTRACEOPT_CPU

#define DTRACEOPT_CPU 8
CPU to trace

macroDTRACEOPT_BUFRESIZE

#define DTRACEOPT_BUFRESIZE 9
buffer resizing policy

macroDTRACEOPT_GRABANON

#define DTRACEOPT_GRABANON 10
grab anonymous state, if any

macroDTRACEOPT_FLOWINDENT

#define DTRACEOPT_FLOWINDENT 11
indent function entry/return

macroDTRACEOPT_QUIET

#define DTRACEOPT_QUIET 12
only output explicitly traced data

macroDTRACEOPT_STACKFRAMES

#define DTRACEOPT_STACKFRAMES 13
number of stack frames

macroDTRACEOPT_USTACKFRAMES

#define DTRACEOPT_USTACKFRAMES 14
number of user stack frames

macroDTRACEOPT_AGGRATE

#define DTRACEOPT_AGGRATE 15
aggregation snapshot rate

macroDTRACEOPT_SWITCHRATE

#define DTRACEOPT_SWITCHRATE 16
buffer switching rate

macroDTRACEOPT_STATUSRATE

#define DTRACEOPT_STATUSRATE 17
status rate

macroDTRACEOPT_DESTRUCTIVE

#define DTRACEOPT_DESTRUCTIVE 18
destructive actions allowed

macroDTRACEOPT_STACKINDENT

#define DTRACEOPT_STACKINDENT 19
output indent for stack traces

macroDTRACEOPT_RAWBYTES

#define DTRACEOPT_RAWBYTES 20
always print bytes in raw form

macroDTRACEOPT_JSTACKFRAMES

#define DTRACEOPT_JSTACKFRAMES 21
number of jstack() frames

macroDTRACEOPT_JSTACKSTRSIZE

#define DTRACEOPT_JSTACKSTRSIZE 22
size of jstack() string table

macroDTRACEOPT_AGGSORTKEY

#define DTRACEOPT_AGGSORTKEY 23
sort aggregations by key

macroDTRACEOPT_AGGSORTREV

#define DTRACEOPT_AGGSORTREV 24
reverse-sort aggregations

macroDTRACEOPT_AGGSORTPOS

#define DTRACEOPT_AGGSORTPOS 25
agg. position to sort on

macroDTRACEOPT_AGGSORTKEYPOS

#define DTRACEOPT_AGGSORTKEYPOS 26
agg. key position to sort on

macroDTRACEOPT_AGGHIST

#define DTRACEOPT_AGGHIST 27
histogram aggregation output

macroDTRACEOPT_AGGPACK

#define DTRACEOPT_AGGPACK 28
packed aggregation output

macroDTRACEOPT_AGGZOOM

#define DTRACEOPT_AGGZOOM 29
zoomed aggregation scaling

macroDTRACEOPT_TEMPORAL

#define DTRACEOPT_TEMPORAL 30
temporally ordered output

macroDTRACEOPT_STACKSYMBOLS

#define DTRACEOPT_STACKSYMBOLS 31
clear to prevent stack symbolication

macroDTRACEOPT_BUFLIMIT

#define DTRACEOPT_BUFLIMIT 32
buffer signaling limit in % of the size

macroDTRACEOPT_MAX

#define DTRACEOPT_MAX 33
number of options

macroDTRACEOPT_UNSET

#define DTRACEOPT_UNSET (dtrace_optval_t)-2
unset option

macroDTRACEOPT_BUFPOLICY_RING

#define DTRACEOPT_BUFPOLICY_RING 0
ring buffer

macroDTRACEOPT_BUFPOLICY_FILL

#define DTRACEOPT_BUFPOLICY_FILL 1
fill buffer, then stop

macroDTRACEOPT_BUFPOLICY_SWITCH

#define DTRACEOPT_BUFPOLICY_SWITCH 2
switch buffers

macroDTRACEOPT_BUFRESIZE_AUTO

#define DTRACEOPT_BUFRESIZE_AUTO 0
automatic resizing

macroDTRACEOPT_BUFRESIZE_MANUAL

#define DTRACEOPT_BUFRESIZE_MANUAL 1
manual resizing

structdtrace_bufdesc

DTrace Buffer Interface In order to get a snapshot of the principal or aggregation buffer, user-level passes a buffer description to the kernel with the dtrace_bufdesc structure. This describes which CPU user-level is interested in, and where user-level wishes the kernel to snapshot the buffer to (the dtbd_data field). The kernel uses the same structure to pass back some information regarding the buffer: the size of data actually copied out, the number of drops, the number of errors, the offset of the oldest record, and the time of the snapshot. If the buffer policy is a "switch" policy, taking a snapshot of the principal buffer has the additional effect of switching the active and inactive buffers. Taking a snapshot of the aggregation buffer _always_ has the additional effect of switching the active and inactive buffers.
size 48, align 8
uint64_tdtbd_sizesize of buffer
uint32_tdtbd_cpuCPU or DTRACE_CPUALL
uint32_tdtbd_errorsnumber of errors
uint64_tdtbd_dropsnumber of drops
char *dtbd_datadata
uint64_tdtbd_oldestoffset of oldest record
uint64_tdtbd_timestamphrtime of snapshot

typedefdtrace_bufdesc_t

typedef struct dtrace_bufdesc dtrace_bufdesc_t;

structdtrace_rechdr

Each record in the buffer (dtbd_data) begins with a header that includes the epid and a timestamp. The timestamp is split into two 4-byte parts so that we do not require 8-byte alignment.
size 12, align 4
dtrace_epid_tdtrh_epidenabled probe id
uint32_tdtrh_timestamp_hihigh bits of hrtime_t
uint32_tdtrh_timestamp_lolow bits of hrtime_t

typedefdtrace_rechdr_t

typedef struct dtrace_rechdr dtrace_rechdr_t;

macroDTRACE_RECORD_LOAD_TIMESTAMP

#define DTRACE_RECORD_LOAD_TIMESTAMP(dtrh) ((dtrh)->dtrh_timestamp_lo +
	((uint64_t)(dtrh)->dtrh_timestamp_hi << 32))

macroDTRACE_RECORD_STORE_TIMESTAMP

#define DTRACE_RECORD_STORE_TIMESTAMP(dtrh, hrtime) {
	(dtrh)->dtrh_timestamp_lo = (uint32_t)hrtime;
	(dtrh)->dtrh_timestamp_hi = hrtime >> 32;
}

structdtrace_status

DTrace Status The status of DTrace is relayed via the dtrace_status structure. This structure contains members to count drops other than the capacity drops available via the buffer interface (see above). This consists of dynamic drops (including capacity dynamic drops, rinsing drops and dirty drops), and speculative drops (including capacity speculative drops, drops due to busy speculative buffers and drops due to unavailable speculative buffers). Additionally, the status structure contains a field to indicate the number of "fill"-policy buffers have been filled and a boolean field to indicate that exit() has been called. If the dtst_exiting field is non-zero, no further data will be generated until tracing is stopped (at which time any enablings of the END action will be processed); if user-level sees that this field is non-zero, tracing should be stopped as soon as possible.
size 88, align 8
uint64_tdtst_dyndropsdynamic drops
uint64_tdtst_dyndrops_rinsingdyn drops due to rinsing
uint64_tdtst_dyndrops_dirtydyn drops due to dirty
uint64_tdtst_specdropsspeculative drops
uint64_tdtst_specdrops_busyspec drops due to busy
uint64_tdtst_specdrops_unavailspec drops due to unavail
uint64_tdtst_errorstotal errors
uint64_tdtst_fillednumber of filled bufs
uint64_tdtst_stkstroverflowsstack string tab overflows
uint64_tdtst_dblerrorserrors in ERROR probes
chardtst_killednon-zero if killed
chardtst_exitingnon-zero if exit() called
char[6]dtst_padpad out to 64-bit align

typedefdtrace_status_t

typedef struct dtrace_status dtrace_status_t;

structdtrace_conf

DTrace Configuration User-level may need to understand some elements of the kernel DTrace configuration in order to generate correct DIF. This information is conveyed via the dtrace_conf structure.
size 48, align 4
uint_tdtc_difversionsupported DIF version
uint_tdtc_difintregs# of DIF integer registers
uint_tdtc_diftupregs# of DIF tuple registers
uint_tdtc_ctfmodelCTF data model
uint_t[8]dtc_padreserved for future use

typedefdtrace_conf_t

typedef struct dtrace_conf dtrace_conf_t;

macroDTRACEFLT_UNKNOWN

DTrace Faults The constants below DTRACEFLT_LIBRARY indicate probe processing faults; constants at or above DTRACEFLT_LIBRARY indicate faults in probe postprocessing at user-level. Probe processing faults induce an ERROR probe and are replicated in unistd.d to allow users' ERROR probes to decode the error condition using thse symbolic labels.
#define DTRACEFLT_UNKNOWN 0
Unknown fault

macroDTRACEFLT_BADADDR

#define DTRACEFLT_BADADDR 1
Bad address

macroDTRACEFLT_BADALIGN

#define DTRACEFLT_BADALIGN 2
Bad alignment

macroDTRACEFLT_ILLOP

#define DTRACEFLT_ILLOP 3
Illegal operation

macroDTRACEFLT_DIVZERO

#define DTRACEFLT_DIVZERO 4
Divide-by-zero

macroDTRACEFLT_NOSCRATCH

#define DTRACEFLT_NOSCRATCH 5
Out of scratch space

macroDTRACEFLT_KPRIV

#define DTRACEFLT_KPRIV 6
Illegal kernel access

macroDTRACEFLT_UPRIV

#define DTRACEFLT_UPRIV 7
Illegal user access

macroDTRACEFLT_TUPOFLOW

#define DTRACEFLT_TUPOFLOW 8
Tuple stack overflow

macroDTRACEFLT_BADSTACK

#define DTRACEFLT_BADSTACK 9
Bad stack

macroDTRACEFLT_LIBRARY

#define DTRACEFLT_LIBRARY 1000
Library-level fault

structdtrace_argdesc

DTrace Argument Types Because it would waste both space and time, argument types do not reside with the probe. In order to determine argument types for args[X] variables, the D compiler queries for argument types on a probe-by-probe basis. (This optimizes for the common case that arguments are either not used or used in an untyped fashion.) Typed arguments are specified with a string of the type name in the dtragd_native member of the argument description structure. Typed arguments may be further translated to types of greater stability; the provider indicates such a translated argument by filling in the dtargd_xlate member with the string of the translated type. Finally, the provider may indicate which argument value a given argument maps to by setting the dtargd_mapping member -- allowing a single argument to map to multiple args[X] variables.
size 268, align 4
dtrace_id_tdtargd_idprobe identifier
intdtargd_ndxarg number (-1 iff none)
intdtargd_mappingvalue mapping
char[128]dtargd_nativenative type name
char[128]dtargd_xlatetranslated type name

typedefdtrace_argdesc_t

typedef struct dtrace_argdesc dtrace_argdesc_t;

typedefdtrace_stability_t

DTrace Stability Attributes Each DTrace provider advertises the name and data stability of each of its probe description components, as well as its architectural dependencies. The D compiler can query the provider attributes (dtrace_pattr_t below) in order to compute the properties of an input program and report them.
typedef uint8_t dtrace_stability_t
stability code (see attributes(5))

typedefdtrace_class_t

typedef uint8_t dtrace_class_t
architectural dependency class

macroDTRACE_STABILITY_INTERNAL

#define DTRACE_STABILITY_INTERNAL 0
private to DTrace itself

macroDTRACE_STABILITY_PRIVATE

#define DTRACE_STABILITY_PRIVATE 1
private to Sun (see docs)

macroDTRACE_STABILITY_OBSOLETE

#define DTRACE_STABILITY_OBSOLETE 2
scheduled for removal

macroDTRACE_STABILITY_EXTERNAL

#define DTRACE_STABILITY_EXTERNAL 3
not controlled by Sun

macroDTRACE_STABILITY_UNSTABLE

#define DTRACE_STABILITY_UNSTABLE 4
new or rapidly changing

macroDTRACE_STABILITY_EVOLVING

#define DTRACE_STABILITY_EVOLVING 5
less rapidly changing

macroDTRACE_STABILITY_STABLE

#define DTRACE_STABILITY_STABLE 6
mature interface from Sun

macroDTRACE_STABILITY_STANDARD

#define DTRACE_STABILITY_STANDARD 7
industry standard

macroDTRACE_STABILITY_MAX

#define DTRACE_STABILITY_MAX 7
maximum valid stability

macroDTRACE_CLASS_UNKNOWN

#define DTRACE_CLASS_UNKNOWN 0
unknown architectural dependency

macroDTRACE_CLASS_CPU

#define DTRACE_CLASS_CPU 1
CPU-module-specific

macroDTRACE_CLASS_PLATFORM

#define DTRACE_CLASS_PLATFORM 2
platform-specific (uname -i)

macroDTRACE_CLASS_GROUP

#define DTRACE_CLASS_GROUP 3
hardware-group-specific (uname -m)

macroDTRACE_CLASS_ISA

#define DTRACE_CLASS_ISA 4
ISA-specific (uname -p)

macroDTRACE_CLASS_COMMON

#define DTRACE_CLASS_COMMON 5
common to all systems

macroDTRACE_CLASS_MAX

#define DTRACE_CLASS_MAX 5
maximum valid class

macroDTRACE_PRIV_NONE

#define DTRACE_PRIV_NONE 0x0000

macroDTRACE_PRIV_KERNEL

#define DTRACE_PRIV_KERNEL 0x0001

macroDTRACE_PRIV_USER

#define DTRACE_PRIV_USER 0x0002

macroDTRACE_PRIV_PROC

#define DTRACE_PRIV_PROC 0x0004

macroDTRACE_PRIV_OWNER

#define DTRACE_PRIV_OWNER 0x0008

macroDTRACE_PRIV_ZONEOWNER

#define DTRACE_PRIV_ZONEOWNER 0x0010

structdtrace_ppriv

size 12, align 4
uint32_tdtpp_flagsprivilege flags
uid_tdtpp_uiduser ID
zoneid_tdtpp_zoneidzone ID

typedefdtrace_ppriv_t

typedef struct dtrace_ppriv dtrace_ppriv_t;

structdtrace_attribute

size 3, align 1
dtrace_stability_tdtat_nameentity name stability
dtrace_stability_tdtat_dataentity data stability
dtrace_class_tdtat_classentity data dependency

typedefdtrace_attribute_t

typedef struct dtrace_attribute dtrace_attribute_t;

structdtrace_pattr

size 15, align 1
dtrace_attribute_tdtpa_providerprovider attributes
dtrace_attribute_tdtpa_modmodule attributes
dtrace_attribute_tdtpa_funcfunction attributes
dtrace_attribute_tdtpa_namename attributes
dtrace_attribute_tdtpa_argsargs[] attributes

typedefdtrace_pattr_t

typedef struct dtrace_pattr dtrace_pattr_t;

structdtrace_providerdesc

size 92, align 4
char[64]dtvd_nameprovider name
dtrace_pattr_tdtvd_attrstability attributes
dtrace_ppriv_tdtvd_privprivileges required

typedefdtrace_providerdesc_t

typedef struct dtrace_providerdesc dtrace_providerdesc_t;

macroDTRACEIOC

coding this as IOC_VOID allows this driver to handle its own copyin/copuout
#define DTRACEIOC _IO('d',0)

macroDTRACEIOC_PROVIDER

#define DTRACEIOC_PROVIDER (DTRACEIOC | 1)
provider query

macroDTRACEIOC_PROBES

#define DTRACEIOC_PROBES (DTRACEIOC | 2)
probe query

macroDTRACEIOC_BUFSNAP

#define DTRACEIOC_BUFSNAP (DTRACEIOC | 4)
snapshot buffer

macroDTRACEIOC_PROBEMATCH

#define DTRACEIOC_PROBEMATCH (DTRACEIOC | 5)
match probes

macroDTRACEIOC_ENABLE

#define DTRACEIOC_ENABLE (DTRACEIOC | 6)
enable probes

macroDTRACEIOC_AGGSNAP

#define DTRACEIOC_AGGSNAP (DTRACEIOC | 7)
snapshot agg.

macroDTRACEIOC_EPROBE

#define DTRACEIOC_EPROBE (DTRACEIOC | 8)
get eprobe desc.

macroDTRACEIOC_PROBEARG

#define DTRACEIOC_PROBEARG (DTRACEIOC | 9)
get probe arg

macroDTRACEIOC_CONF

#define DTRACEIOC_CONF (DTRACEIOC | 10)
get config.

macroDTRACEIOC_STATUS

#define DTRACEIOC_STATUS (DTRACEIOC | 11)
get status

macroDTRACEIOC_GO

#define DTRACEIOC_GO (DTRACEIOC | 12)
start tracing

macroDTRACEIOC_STOP

#define DTRACEIOC_STOP (DTRACEIOC | 13)
stop tracing

macroDTRACEIOC_AGGDESC

#define DTRACEIOC_AGGDESC (DTRACEIOC | 15)
get agg. desc.

macroDTRACEIOC_FORMAT

#define DTRACEIOC_FORMAT (DTRACEIOC | 16)
get format str

macroDTRACEIOC_DOFGET

#define DTRACEIOC_DOFGET (DTRACEIOC | 17)
get DOF

macroDTRACEIOC_REPLICATE

#define DTRACEIOC_REPLICATE (DTRACEIOC | 18)
replicate enab

macroDTRACEIOC_MODUUIDSLIST

#define DTRACEIOC_MODUUIDSLIST (DTRACEIOC | 30)
APPLE ONLY, query for modules with missing symbols

macroDTRACEIOC_PROVMODSYMS

#define DTRACEIOC_PROVMODSYMS (DTRACEIOC | 31)
APPLE ONLY, provide missing symbols for a given module

macroDTRACEIOC_PROCWAITFOR

#define DTRACEIOC_PROCWAITFOR (DTRACEIOC | 32)
APPLE ONLY, wait for process exec

macroDTRACEIOC_SLEEP

#define DTRACEIOC_SLEEP (DTRACEIOC | 33)
APPLE ONLY, sleep

macroDTRACEIOC_SIGNAL

#define DTRACEIOC_SIGNAL (DTRACEIOC | 34)
APPLE ONLY, signal sleeping process

structdtrace_symbol

size 144, align 8
uint64_tdtsym_addraddress of the symbol
uint64_tdtsym_sizesize of the symbol, must be uint64_t to maintain alignment when called by 64b uproc in i386 kernel
char[128]dtsym_namesymbol name

typedefdtrace_symbol_t

typedef struct dtrace_symbol dtrace_symbol_t;

structdtrace_module_symbols

size 168, align 8
UUIDdtmodsyms_uuid
uint64_tdtmodsyms_count
dtrace_symbol_t[1]dtmodsyms_symbols

typedefdtrace_module_symbols_t

typedef struct dtrace_module_symbols dtrace_module_symbols_t;

macroDTRACE_MODULE_SYMBOLS_SIZE

Safely compute the size in bytes of space we need to copyin module's symbols from userspace. Assumes that count has been checked to be at least 1.
#define DTRACE_MODULE_SYMBOLS_SIZE(count) ({
		size_t _sym_count = (size_t)(count - 1);
		size_t _buf_size = 0;
		if (os_mul_and_add_overflow(_sym_count,
									sizeof(dtrace_symbol_t),
									sizeof(dtrace_module_symbols_t),
									&_buf_size)) {
			_buf_size = 0;
		}
		_buf_size; })

structdtrace_module_uuids_list

size 24, align 8
uint64_tdtmul_count
UUID[1]dtmul_uuid

typedefdtrace_module_uuids_list_t

typedef struct dtrace_module_uuids_list dtrace_module_uuids_list_t;

macroDTRACE_MODULE_UUIDS_LIST_SIZE

#define DTRACE_MODULE_UUIDS_LIST_SIZE(count) (sizeof(dtrace_module_uuids_list_t) + ((count - 1) * sizeof(UUID)))

structdtrace_procdesc

size 136, align 4
char[128]p_nameMust be specified by user-space
intp_name_lengthSet or modified by the Kernel
pid_tp_pid

typedefdtrace_procdesc_t

typedef struct dtrace_procdesc dtrace_procdesc_t;

macroDTRACE_WAKE_TIMEOUT

DTrace wake reasons. This is used in userspace to determine what's the reason why it woke up, to start aggregating / switching buffer right away if it is because a buffer got over its limit
#define DTRACE_WAKE_TIMEOUT 0
dtrace client woke up because of a timeout

macroDTRACE_WAKE_BUF_LIMIT

#define DTRACE_WAKE_BUF_LIMIT 1
dtrace client woke up because of a over limit buffer

macroDTRACEHIOC_REMOVE

#define DTRACEHIOC_REMOVE _IO('h', 2)
remove helper

macroDTRACEHIOC_ADDDOF

#define DTRACEHIOC_ADDDOF _IOW('h', 4, user_addr_t)
add helper DOF

structdof_helper

size 80, align 8
char[64]dofhp_modexecutable or library name
uint64_tdofhp_addrbase address of object
uint64_tdofhp_dofaddress of helper DOF

typedefdof_helper_t

typedef struct dof_helper dof_helper_t;

structdof_ioctl_data

This structure is used to register one or more dof_helper_t(s). For counts greater than one, malloc the structure as if the dofiod_helpers field was "count" sized. The kernel will copyin data of size: sizeof(dof_ioctl_data_t) + ((count - 1) * sizeof(dof_helper_t))
size 88, align 8
uint64_tdofiod_countThis field must be 64 bits to keep the alignment the same when 64 bit user procs are sending data to 32 bit xnu
dof_helper_t[1]dofiod_helpers

typedefdof_ioctl_data_t

typedef struct dof_ioctl_data dof_ioctl_data_t;

macroDOF_IOCTL_DATA_T_SIZE

#define DOF_IOCTL_DATA_T_SIZE(count) (sizeof(dof_ioctl_data_t) + ((count - 1) * sizeof(dof_helper_t)))

macroDTRACEMNR_DTRACE

#define DTRACEMNR_DTRACE "dtrace"
node for DTrace ops

macroDTRACEMNR_HELPER

#define DTRACEMNR_HELPER "dtracehelper"
node for helpers

macroDTRACEMNRN_DTRACE

#define DTRACEMNRN_DTRACE 0
minor for DTrace ops

macroDTRACEMNRN_HELPER

#define DTRACEMNRN_HELPER 1
minor for helpers

macroDTRACEMNRN_CLONE

#define DTRACEMNRN_CLONE 2
first clone minor

macroDTRACE_INVOP_NOP

#define DTRACE_INVOP_NOP 4

macroDTRACE_INVOP_RET

#define DTRACE_INVOP_RET 5

macroDTRACE_INVOP_B

#define DTRACE_INVOP_B 6