freebsd proc_list

This commit is contained in:
Doug MacEachern 2005-02-09 04:31:08 +00:00
parent 7d61e468b2
commit 06abd079e8
1 changed files with 13 additions and 2 deletions

View File

@ -374,9 +374,20 @@ int sigar_proc_list_get(sigar_t *sigar,
return SIGAR_OK; return SIGAR_OK;
#else #else
/*XXX above compiles on freebsd but no workie */ int i, num;
return sigar_proc_list_procfs_get(sigar, proclist); 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; i<num; i++) {
proclist->data[proclist->number++] = proc[i].kp_proc.p_pid;
}
#endif #endif
return SIGAR_OK;
} }
int sigar_proc_stat_get(sigar_t *sigar, int sigar_proc_stat_get(sigar_t *sigar,