From 6ad0b561e78d7480b81506eee6118f27a5090eff Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 13 Feb 2005 03:24:33 +0000 Subject: [PATCH] freebsd proc_mem --- src/os/darwin/darwin_sigar.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 7b3286fc..0dc96f79 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -473,7 +473,24 @@ int sigar_proc_mem_get(sigar_t *sigar, sigar_pid_t pid, return SIGAR_OK; #else - return SIGAR_ENOTIMPL; + int status = sigar_get_pinfo(sigar, pid); + struct kinfo_proc *pinfo = sigar->pinfo; + + if (status != SIGAR_OK) { + return status; + } + + procmem->size = procmem->vsize = + (pinfo->kp_eproc.e_vm.vm_tsize + + pinfo->kp_eproc.e_vm.vm_dsize + + pinfo->kp_eproc.e_vm.vm_ssize) * sigar->pagesize; + + procmem->resident = procmem->rss = + pinfo->kp_eproc.e_vm.vm_rssize * sigar->pagesize; + + procmem->share = SIGAR_FIELD_NOTIMPL; + + return SIGAR_OK; #endif }