* Handle the different ioctl design.
* Use FreeBSD's process library API. * Make the file compile cleanly.
This commit is contained in:
parent
40de299f6b
commit
d9ce014461
@ -32,7 +32,11 @@
|
||||
#include <unistd.h>
|
||||
#include <dt_impl.h>
|
||||
#include <assert.h>
|
||||
#if defined(sun)
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
#define DTRACE_AHASHSIZE 32779 /* big 'ol prime */
|
||||
@ -54,7 +58,7 @@ static int dt_keypos;
|
||||
static void
|
||||
dt_aggregate_count(int64_t *existing, int64_t *new, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint_t i;
|
||||
|
||||
for (i = 0; i < size / sizeof (int64_t); i++)
|
||||
existing[i] = existing[i] + new[i];
|
||||
@ -207,9 +211,10 @@ dt_aggregate_lquantizedcmp(int64_t *lhs, int64_t *rhs)
|
||||
static int
|
||||
dt_aggregate_quantizedcmp(int64_t *lhs, int64_t *rhs)
|
||||
{
|
||||
int nbuckets = DTRACE_QUANTIZE_NBUCKETS, i;
|
||||
int nbuckets = DTRACE_QUANTIZE_NBUCKETS;
|
||||
long double ltotal = 0, rtotal = 0;
|
||||
int64_t lzero, rzero;
|
||||
uint_t i;
|
||||
|
||||
for (i = 0; i < nbuckets; i++) {
|
||||
int64_t bucketval = DTRACE_QUANTIZE_BUCKETVAL(i);
|
||||
@ -259,7 +264,11 @@ dt_aggregate_usym(dtrace_hdl_t *dtp, uint64_t *data)
|
||||
|
||||
dt_proc_lock(dtp, P);
|
||||
|
||||
#if defined(sun)
|
||||
if (Plookup_by_addr(P, *pc, NULL, 0, &sym) == 0)
|
||||
#else
|
||||
if (proc_addr2sym(P, *pc, NULL, 0, &sym) == 0)
|
||||
#endif
|
||||
*pc = sym.st_value;
|
||||
|
||||
dt_proc_unlock(dtp, P);
|
||||
@ -282,7 +291,11 @@ dt_aggregate_umod(dtrace_hdl_t *dtp, uint64_t *data)
|
||||
|
||||
dt_proc_lock(dtp, P);
|
||||
|
||||
#if defined(sun)
|
||||
if ((map = Paddr_to_map(P, *pc)) != NULL)
|
||||
#else
|
||||
if ((map = proc_addr2map(P, *pc)) != NULL)
|
||||
#endif
|
||||
*pc = map->pr_vaddr;
|
||||
|
||||
dt_proc_unlock(dtp, P);
|
||||
@ -367,7 +380,11 @@ dt_aggregate_snap_cpu(dtrace_hdl_t *dtp, processorid_t cpu)
|
||||
|
||||
buf->dtbd_cpu = cpu;
|
||||
|
||||
#if defined(sun)
|
||||
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
|
||||
#else
|
||||
if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) {
|
||||
#endif
|
||||
if (errno == ENOENT) {
|
||||
/*
|
||||
* If that failed with ENOENT, it may be because the
|
||||
@ -636,7 +653,7 @@ dtrace_aggregate_snap(dtrace_hdl_t *dtp)
|
||||
return (0);
|
||||
|
||||
for (i = 0; i < agp->dtat_ncpus; i++) {
|
||||
if (rval = dt_aggregate_snap_cpu(dtp, agp->dtat_cpus[i]))
|
||||
if ((rval = dt_aggregate_snap_cpu(dtp, agp->dtat_cpus[i])))
|
||||
return (rval);
|
||||
}
|
||||
|
||||
@ -1114,7 +1131,7 @@ dt_aggwalk_rval(dtrace_hdl_t *dtp, dt_ahashent_t *h, int rval)
|
||||
|
||||
case DTRACE_AGGWALK_REMOVE: {
|
||||
dtrace_aggdata_t *aggdata = &h->dtahe_data;
|
||||
int i, max_cpus = agp->dtat_maxcpu;
|
||||
int max_cpus = agp->dtat_maxcpu;
|
||||
|
||||
/*
|
||||
* First, remove this hash entry from its hash chain.
|
||||
|
Loading…
Reference in New Issue
Block a user