Merge branch 'sigar-1.6'
This commit is contained in:
commit
6a5b8c00de
|
@ -2192,8 +2192,22 @@ int sigar_disk_usage_get(sigar_t *sigar, const char *name,
|
||||||
IOObjectRelease(service);
|
IOObjectRelease(service);
|
||||||
IOObjectRelease(parent);
|
IOObjectRelease(parent);
|
||||||
|
|
||||||
|
return SIGAR_OK;
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
/* XXX incomplete */
|
||||||
|
struct sigar_statfs buf;
|
||||||
|
|
||||||
|
if (sigar_statfs(name, &buf) < 0) {
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
SIGAR_DISK_STATS_INIT(disk);
|
||||||
|
|
||||||
|
disk->reads = buf.f_syncreads + buf.f_asyncreads;
|
||||||
|
disk->writes = buf.f_syncwrites + buf.f_asyncwrites;
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
#else
|
#else
|
||||||
|
SIGAR_DISK_STATS_INIT(disk);
|
||||||
return SIGAR_ENOTIMPL;
|
return SIGAR_ENOTIMPL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2202,36 +2216,15 @@ 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)
|
||||||
{
|
{
|
||||||
struct sigar_statfs buf;
|
int status = sigar_statvfs(sigar, dirname, fsusage);
|
||||||
sigar_uint64_t val, bsize;
|
|
||||||
|
|
||||||
if (sigar_statfs(dirname, &buf) < 0) {
|
if (status != SIGAR_OK) {
|
||||||
return errno;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bsize = buf.f_bsize / 512;
|
|
||||||
val = buf.f_blocks;
|
|
||||||
fsusage->total = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize);
|
|
||||||
val = buf.f_bfree;
|
|
||||||
fsusage->free = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize);
|
|
||||||
val = buf.f_bavail;
|
|
||||||
fsusage->avail = SIGAR_FS_BLOCKS_TO_BYTES(val, bsize);
|
|
||||||
fsusage->used = fsusage->total - fsusage->free;
|
|
||||||
fsusage->files = buf.f_files;
|
|
||||||
fsusage->free_files = buf.f_ffree;
|
|
||||||
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);
|
||||||
|
|
||||||
#if defined(__FreeBSD__)
|
|
||||||
fsusage->disk_reads = buf.f_syncreads + buf.f_asyncreads;
|
|
||||||
fsusage->disk_writes = buf.f_syncwrites + buf.f_asyncwrites;
|
|
||||||
fsusage->disk_read_bytes = SIGAR_FIELD_NOTIMPL;
|
|
||||||
fsusage->disk_write_bytes = SIGAR_FIELD_NOTIMPL;
|
|
||||||
fsusage->disk_queue = SIGAR_FIELD_NOTIMPL;
|
|
||||||
#elif defined(DARWIN)
|
|
||||||
sigar_disk_usage_get(sigar, dirname, &fsusage->disk);
|
sigar_disk_usage_get(sigar, dirname, &fsusage->disk);
|
||||||
#else
|
|
||||||
SIGAR_DISK_STATS_INIT(&fsusage->disk);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return SIGAR_OK;
|
return SIGAR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue