start solaris disk_usage impl

This commit is contained in:
Doug MacEachern 2007-10-15 03:50:07 +00:00
parent a37f008dd7
commit e82820a8c5
1 changed files with 27 additions and 0 deletions

View File

@ -1561,6 +1561,10 @@ static int fs_kstat_read(sigar_t *sigar,
kstat_read(sigar->kc, ksp, NULL); kstat_read(sigar->kc, ksp, NULL);
if (ksp->ks_type != KSTAT_TYPE_IO) {
return EINVAL;
}
io = (kstat_io_t *)ksp->ks_data; io = (kstat_io_t *)ksp->ks_data;
disk->reads = io->reads; disk->reads = io->reads;
@ -1620,6 +1624,29 @@ static int get_fs_kstat(sigar_t *sigar,
return ENOENT; return ENOENT;
} }
int sigar_disk_usage_get(sigar_t *sigar, const char *name,
sigar_disk_usage_t *disk)
{
kstat_t *ksp;
if (sigar_kstat_update(sigar) == -1) {
return errno;
}
SIGAR_DISK_STATS_INIT(disk);
/* XXX optimize */
for (ksp = sigar->kc->kc_chain;
ksp;
ksp = ksp->ks_next)
{
if (strEQ(ksp->ks_name, name)) {
return fs_kstat_read(sigar, disk, ksp);
}
}
return ENOENT;
}
int sigar_file_system_usage_get(sigar_t *sigar, int sigar_file_system_usage_get(sigar_t *sigar,
const char *dirname, const char *dirname,
sigar_file_system_usage_t *fsusage) sigar_file_system_usage_t *fsusage)