aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstat
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-27 13:10:42 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-27 13:10:42 +0000
commit0d85523cf3c9fce6ef3840bb52cc9887a21d0ccb (patch)
tree3dc86d2794529114e3c89e074dd953b969a59070 /tools/xenstat
parent98317c0a457c92a7d199d4a2a72062a8dfed02cb (diff)
downloadxen-0d85523cf3c9fce6ef3840bb52cc9887a21d0ccb.tar.gz
xen-0d85523cf3c9fce6ef3840bb52cc9887a21d0ccb.tar.bz2
xen-0d85523cf3c9fce6ef3840bb52cc9887a21d0ccb.zip
Fix libxenstat on Solaris
Recent Solaris enhancements have changed the way virtual NIC statistics are collected - fix libxenstat up for this. Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/xenstat')
-rw-r--r--tools/xenstat/libxenstat/src/xenstat_solaris.c40
1 files changed, 7 insertions, 33 deletions
diff --git a/tools/xenstat/libxenstat/src/xenstat_solaris.c b/tools/xenstat/libxenstat/src/xenstat_solaris.c
index 719c30d8ac..d79c410f44 100644
--- a/tools/xenstat/libxenstat/src/xenstat_solaris.c
+++ b/tools/xenstat/libxenstat/src/xenstat_solaris.c
@@ -113,49 +113,23 @@ static void xenstat_uninit_devs(xenstat_handle *handle, int type)
priv->kc = NULL;
}
-static int parse_nic(const char *nic, char *module, int *instance)
-{
- const char *c;
-
- for (c = &nic[strlen(nic) - 1]; c != nic && isdigit(*c); c--)
- ;
-
- if (c == nic)
- return 0;
-
- c++;
-
- if (sscanf(c, "%d", instance) != 1)
- return 0;
-
- strncpy(module, nic, c - nic);
- module[c - nic] = '\0';
- return 1;
-}
-
static int update_dev_stats(priv_data_t *priv, stdevice_t *dev)
{
- char mod[256];
- const char *name;
- int inst;
kstat_t *ksp;
+ if (kstat_chain_update(priv->kc) == -1)
+ return 0;
+
if (dev->type == DEVICE_NIC) {
- if (!parse_nic(dev->name, mod, &inst))
- return 0;
- name = "mac";
+ ksp = kstat_lookup(priv->kc, "link", 0, (char *)dev->name);
} else {
- strcpy(mod, "xdb");
- inst = dev->instance;
- name = "req_statistics";
+ ksp = kstat_lookup(priv->kc, "xdb", dev->instance,
+ (char *)"req_statistics");
}
- if (kstat_chain_update(priv->kc) == -1)
- return 0;
-
- ksp = kstat_lookup(priv->kc, mod, inst, (char *)name);
if (ksp == NULL)
return 0;
+
if (kstat_read(priv->kc, ksp, NULL) == -1)
return 0;