diff --git a/src/os/linux/linux_sigar.c b/src/os/linux/linux_sigar.c index 2160232e..9860fb60 100644 --- a/src/os/linux/linux_sigar.c +++ b/src/os/linux/linux_sigar.c @@ -233,7 +233,7 @@ static SIGAR_INLINE sigar_uint64_t sigar_meminfo(char *buffer, int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem) { - sigar_uint64_t buffer, cached; + sigar_uint64_t buffers, cached, kern; char buffer[BUFSIZ]; int status = sigar_file2str(PROC_MEMINFO, @@ -247,11 +247,12 @@ int sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem) mem->free = sigar_meminfo(buffer, MEMINFO_PARAM("MemFree")); mem->used = mem->total - mem->free; - buffer = sigar_meminfo(buffer, MEMINFO_PARAM("Buffers")); - cached = sigar_meminfo(buffer, MEMINFO_PARAM("Cached")); + buffers = sigar_meminfo(buffer, MEMINFO_PARAM("Buffers")); + cached = sigar_meminfo(buffer, MEMINFO_PARAM("Cached")); - mem->actual_free = mem->free; - mem->actual_used = mem->used; + kern = buffers + cached; + mem->actual_free = mem->free + kern; + mem->actual_used = mem->used - kern; mem->shared = 0; /* XXX where did this go in 2.6?? */