Changeset View
Changeset View
Standalone View
Standalone View
cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | |||||
#include <errno.h> | #include <errno.h> | ||||
#include <dt_provider.h> | #include <dt_provider.h> | ||||
#include <dt_module.h> | #include <dt_module.h> | ||||
#include <dt_string.h> | #include <dt_string.h> | ||||
#include <dt_list.h> | #include <dt_list.h> | ||||
#include <dt_pid.h> | #include <dt_pid.h> | ||||
#include <dtrace.h> | #include <dtrace.h> | ||||
#include <kinst.h> | |||||
static dt_provider_t * | static dt_provider_t * | ||||
dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h) | dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h) | ||||
{ | { | ||||
dt_list_append(&dtp->dt_provlist, pvp); | dt_list_append(&dtp->dt_provlist, pvp); | ||||
pvp->pv_next = dtp->dt_provs[h]; | pvp->pv_next = dtp->dt_provs[h]; | ||||
dtp->dt_provs[h] = pvp; | dtp->dt_provs[h] = pvp; | ||||
▲ Show 20 Lines • Show All 635 Lines • ▼ Show 20 Lines | dt_probe_info(dtrace_hdl_t *dtp, | ||||
if ((pvp = dt_provider_lookup(dtp, pdp->dtpd_provider)) != NULL) { | if ((pvp = dt_provider_lookup(dtp, pdp->dtpd_provider)) != NULL) { | ||||
size_t keylen = dt_probe_keylen(pdp); | size_t keylen = dt_probe_keylen(pdp); | ||||
char *key = dt_probe_key(pdp, alloca(keylen)); | char *key = dt_probe_key(pdp, alloca(keylen)); | ||||
if ((idp = dt_idhash_lookup(pvp->pv_probes, key)) != NULL) | if ((idp = dt_idhash_lookup(pvp->pv_probes, key)) != NULL) | ||||
prp = idp->di_data; | prp = idp->di_data; | ||||
else if (pdp->dtpd_id != DTRACE_IDNONE) | else if (pdp->dtpd_id != DTRACE_IDNONE) | ||||
prp = dt_probe_discover(pvp, pdp); | prp = dt_probe_discover(pvp, pdp); | ||||
if (strcmp(pvp->pv_desc.dtvd_name, "kinst") == 0) { | |||||
dtrace_kinst_probedesc_t pd; | |||||
if (dtp->dt_kinstfd == -1) { | |||||
int fd; | |||||
fd = open("/dev/dtrace/kinst", O_WRONLY); | |||||
if (fd < 0) { | |||||
(void) dt_set_errno(dtp, errno); | |||||
return (NULL); | |||||
} | |||||
dtp->dt_kinstfd = fd; | |||||
} | |||||
memset(&pd, 0, sizeof(pd)); | |||||
strlcpy(pd.kpd_func, pdp->dtpd_func, | |||||
sizeof (pd.kpd_func)); | |||||
if (n_is_glob) | |||||
pd.kpd_off = -1; | |||||
else | |||||
pd.kpd_off = strtol(pdp->dtpd_name, NULL, 10); | |||||
if (ioctl(dtp->dt_kinstfd, KINSTIOC_MAKEPROBE, &pd) != | |||||
0) { | |||||
(void) dt_set_errno(dtp, errno); | |||||
return (NULL); | |||||
} | |||||
} | |||||
} | } | ||||
/* | /* | ||||
* If no probe was found in our cache, convert the caller's partial | * If no probe was found in our cache, convert the caller's partial | ||||
* probe description into a fully-formed matching probe description by | * probe description into a fully-formed matching probe description by | ||||
* iterating over up to at most two probes that match 'pdp'. We then | * iterating over up to at most two probes that match 'pdp'. We then | ||||
* call dt_probe_discover() on the resulting probe identifier. | * call dt_probe_discover() on the resulting probe identifier. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 191 Lines • Show Last 20 Lines |