* rootdir.c: Add #include <mach/mach4.h>. (rootdir_gc_meminfo): Call vm_cache_statistics() and report the result. --- rootdir.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/rootdir.c b/rootdir.c index 1fa71b0..c24585e 100644 --- a/rootdir.c +++ b/rootdir.c @@ -20,6 +20,7 @@ #include <mach/vm_param.h> #include <mach/vm_statistics.h> #include <mach/default_pager.h> +#include <mach/mach4.h> #include <hurd/paths.h> #include <stdio.h> #include <unistd.h> @@ -263,6 +264,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) host_basic_info_data_t hbi; mach_msg_type_number_t cnt; struct vm_statistics vmstats; + struct vm_cache_statistics cachestats; default_pager_info_t swap; error_t err; @@ -270,6 +272,10 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) if (err) return EIO; + err = vm_cache_statistics (mach_task_self (), &cachestats); + if (err) + return EIO; + cnt = HOST_BASIC_INFO_COUNT; err = host_info (mach_host_self (), HOST_BASIC_INFO, (host_info_t) &hbi, &cnt); if (err) @@ -294,7 +300,7 @@ rootdir_gc_meminfo (void *hook, char **contents, ssize_t *contents_len) (long unsigned) hbi.memory_size / 1024, (long unsigned) vmstats.free_count * PAGE_SIZE / 1024, 0, - 0, + (long unsigned) cachestats.page_count * PAGE_SIZE / 1024, (long unsigned) vmstats.active_count * PAGE_SIZE / 1024, (long unsigned) vmstats.inactive_count * PAGE_SIZE / 1024, (long unsigned) vmstats.wire_count * PAGE_SIZE / 1024, -- 1.7.10.4