diff --git a/src/os/osf1/osf1_sigar.c b/src/os/osf1/osf1_sigar.c index 3b32787e..e6f9732f 100644 --- a/src/os/osf1/osf1_sigar.c +++ b/src/os/osf1/osf1_sigar.c @@ -7,6 +7,8 @@ int sigar_os_open(sigar_t **sigar) { *sigar = malloc(sizeof(**sigar)); + (*sigar)->pagesize = getpagesize(); + return SIGAR_OK; } @@ -45,9 +47,16 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem) int sigar_swap_get(sigar_t *sigar, sigar_swap_t *swap) { - swap->total = -1; - swap->used = -1; - swap->free = -1; + struct tbl_swapinfo info; + + table(TBL_SWAPINFO, -1, &info, 1, sizeof(info)); + + swap->total = info.size; + swap->free = info.free; + swap->total *= sigar->pagesize; + swap->free *= sigar->pagesize; + + swap->used = swap->total - swap->free; return SIGAR_OK; } diff --git a/src/os/osf1/sigar_os.h b/src/os/osf1/sigar_os.h index 46674deb..378270fd 100644 --- a/src/os/osf1/sigar_os.h +++ b/src/os/osf1/sigar_os.h @@ -1,6 +1,12 @@ #ifndef SIGAR_OS_H #define SIGAR_OS_H +#include +/* "i will *punch* you in the *face*" --will ferrell */ +#undef idle +#undef usr +#undef sys + #include #include @@ -9,6 +15,7 @@ struct sigar_t { SIGAR_T_BASE; + int pagesize; }; #endif /* SIGAR_OS_H */