filter out system processes and threads from proc_list
This commit is contained in:
parent
b5bb7c5c4f
commit
6f86a07623
|
@ -429,13 +429,15 @@ int sigar_proc_list_get(sigar_t *sigar,
|
||||||
return SIGAR_EPERM_KMEM;
|
return SIGAR_EPERM_KMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc = kvm_getprocs(sigar->kmem, KERN_PROC_ALL, 0, &num);
|
proc = kvm_getprocs(sigar->kmem, KERN_PROC_PROC, 0, &num);
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue