Indent everything to 4 spaces to make it consistant with the other LibGTop
code.
This commit is contained in:
@@ -40,9 +40,9 @@ static const unsigned long _glibtop_sysdeps_loadavg =
|
||||
int
|
||||
glibtop_init_loadavg_s (glibtop *server)
|
||||
{
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
server->sysdeps.loadavg = _glibtop_sysdeps_loadavg;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Provides load average. */
|
||||
@@ -51,41 +51,39 @@ int
|
||||
glibtop_get_loadavg_s (glibtop *server, glibtop_loadavg *buf)
|
||||
{
|
||||
#ifndef HAVE_GETLOADAVG
|
||||
kstat_ctl_t *kc;
|
||||
kstat_t *ksp;
|
||||
int i;
|
||||
static char *avestrings[] = { "avenrun_1min",
|
||||
"avenrun_5min",
|
||||
"avenrun_15min" };
|
||||
kstat_ctl_t *kc;
|
||||
kstat_t *ksp;
|
||||
int i;
|
||||
static char *avestrings[] = { "avenrun_1min",
|
||||
"avenrun_5min",
|
||||
"avenrun_15min" };
|
||||
#endif
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
memset (buf, 0, sizeof (glibtop_loadavg));
|
||||
|
||||
#ifdef HAVE_GETLOADAVG
|
||||
if (getloadavg (buf->loadavg, 3) < 0)
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
if (getloadavg (buf->loadavg, 3) < 0)
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
#else
|
||||
if(!(kc = server->_priv->machine.kc))
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
switch(kstat_chain_update(kc))
|
||||
{
|
||||
case -1: assert(0); /* Debugging, shouldn't happen */
|
||||
case 0: break;
|
||||
default: glibtop_get_kstats(server);
|
||||
}
|
||||
if(!(ksp = server->_priv->machine.system))
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
if(kstat_read(kc, ksp, NULL) < 0)
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
for(i = 0; i < 3; ++i) /* Do we have a countof macro? */
|
||||
{
|
||||
kstat_named_t *kn;
|
||||
if(!(kc = server->_priv->machine.kc))
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
switch(kstat_chain_update(kc)) {
|
||||
case -1: assert(0); /* Debugging, shouldn't happen */
|
||||
case 0: break;
|
||||
default: glibtop_get_kstats(server);
|
||||
}
|
||||
if(!(ksp = server->_priv->machine.system))
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
if(kstat_read(kc, ksp, NULL) < 0)
|
||||
return -GLIBTOP_ERROR_INCOMPATIBLE_KERNEL;
|
||||
for(i = 0; i < 3; ++i) { /* Do we have a countof macro? */
|
||||
kstat_named_t *kn;
|
||||
|
||||
kn = (kstat_named_t *)kstat_data_lookup(ksp, avestrings[i]);
|
||||
if(kn)
|
||||
buf->loadavg[i] = (double)kn->value.ul / FSCALE;
|
||||
}
|
||||
kn = (kstat_named_t *)kstat_data_lookup(ksp, avestrings[i]);
|
||||
if(kn)
|
||||
buf->loadavg[i] = (double)kn->value.ul / FSCALE;
|
||||
}
|
||||
#endif
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
buf->flags = _glibtop_sysdeps_loadavg;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user