From 06abd079e864e195acc9fd5b55b33458a544c0b8 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 9 Feb 2005 04:31:08 +0000 Subject: [PATCH] freebsd proc_list --- src/os/darwin/darwin_sigar.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/os/darwin/darwin_sigar.c b/src/os/darwin/darwin_sigar.c index 551a3535..2ba5dc74 100644 --- a/src/os/darwin/darwin_sigar.c +++ b/src/os/darwin/darwin_sigar.c @@ -374,9 +374,20 @@ int sigar_proc_list_get(sigar_t *sigar, return SIGAR_OK; #else - /*XXX above compiles on freebsd but no workie */ - return sigar_proc_list_procfs_get(sigar, proclist); + int i, num; + struct kinfo_proc *proc = + kvm_getprocs(sigar->kmem, KERN_PROC_ALL, 0, &num); + + proclist->number = 0; + proclist->size = num; + proclist->data = malloc(sizeof(*(proclist->data)) * num); + + for (i=0; idata[proclist->number++] = proc[i].kp_proc.p_pid; + } #endif + + return SIGAR_OK; } int sigar_proc_stat_get(sigar_t *sigar,