#ifndef _SDT_IMPL_H
#define _SDT_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
extern const char *sdt_prefix;
typedef struct sdt_probedesc {
char *sdpd_name;
#if defined(__APPLE__)
char *sdpd_func;
#endif
unsigned long sdpd_offset;
struct sdt_probedesc *sdpd_next;
} sdt_probedesc_t;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/dtrace.h>
#if !defined(__APPLE__)
#if defined(__i386) || defined(__amd64)
typedef uint8_t sdt_instr_t;
#else
typedef uint32_t sdt_instr_t;
#endif
#else
struct module {
int sdt_nprobes;
sdt_probedesc_t *sdt_probes;
};
extern int sdt_invop(uintptr_t, uintptr_t *, uintptr_t);
void sdt_provide_module(void *, struct modctl *);
void sdt_init(void);
extern int sdt_probetab_size;
extern int sdt_probetab_mask;
#define SDT_ADDR2NDX(addr) ((((uintptr_t)(addr)) >> 4) & sdt_probetab_mask)
#if defined(__i386__) || defined(__x86_64__)
typedef uint8_t sdt_instr_t;
#elif defined(__ppc__) || defined(__ppc64__)
typedef uint32_t sdt_instr_t;
#else
#error Unknown implementation
#endif
#endif
typedef struct sdt_provider {
const char *sdtp_name;
const char *sdtp_prefix;
dtrace_pattr_t *sdtp_attr;
dtrace_provider_id_t sdtp_id;
} sdt_provider_t;
extern sdt_provider_t sdt_providers[];
typedef struct sdt_probe {
sdt_provider_t *sdp_provider;
char *sdp_name;
int sdp_namelen;
dtrace_id_t sdp_id;
struct modctl *sdp_ctl;
int sdp_loadcnt;
int sdp_primary;
sdt_instr_t *sdp_patchpoint;
sdt_instr_t sdp_patchval;
sdt_instr_t sdp_savedval;
struct sdt_probe *sdp_next;
struct sdt_probe *sdp_hashnext;
} sdt_probe_t;
typedef struct sdt_argdesc {
const char *sda_provider;
const char *sda_name;
const int sda_ndx;
const int sda_mapping;
const char *sda_native;
const char *sda_xlate;
} sdt_argdesc_t;
extern void sdt_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *);
#ifdef __cplusplus
}
#endif
#endif