filter out system procs from proc_list

This commit is contained in:
Doug MacEachern 2005-02-19 00:06:44 +00:00
parent 0bd202c57b
commit acdd130d6b
1 changed files with 5 additions and 3 deletions

View File

@ -528,11 +528,13 @@ int sigar_proc_list_get(sigar_t *sigar,
} }
num = len/sizeof(*proc); num = len/sizeof(*proc);
proclist->number = 0; sigar_proc_list_create(proclist);
proclist->size = num;
proclist->data = malloc(sizeof(*(proclist->data)) * num);
for (i=0; i<num; i++) { for (i=0; i<num; i++) {
if (proc[i].KI_FLAG & P_SYSTEM) {
continue;
}
SIGAR_PROC_LIST_GROW(proclist);
proclist->data[proclist->number++] = proc[i].KI_PID; proclist->data[proclist->number++] = proc[i].KI_PID;
} }