summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2008-04-26 04:37:01 +0000
committerjb <jb@FreeBSD.org>2008-04-26 04:37:01 +0000
commit52ee64efcde2fb346f6e7d05f9e48d6258623f84 (patch)
treee3a9a6332698d3c65d382155c2c411b3c0fc30ae /cddl
parent5bfe3a7665f01409c80123be917456143dad2d8e (diff)
downloadFreeBSD-src-52ee64efcde2fb346f6e7d05f9e48d6258623f84.zip
FreeBSD-src-52ee64efcde2fb346f6e7d05f9e48d6258623f84.tar.gz
* Handle the different ioctl design.
* Use FreeBSD's process library API. * Make the file compile cleanly.
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
index 2e66250..ac32f76 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
@@ -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.
OpenPOWER on IntegriCloud