aboutsummaryrefslogtreecommitdiffstats
path: root/netbsd/NetBSDProcessList.c
diff options
context:
space:
mode:
Diffstat (limited to 'netbsd/NetBSDProcessList.c')
-rw-r--r--netbsd/NetBSDProcessList.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c
index 379a491..ab0f0b7 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessList.c
@@ -331,31 +331,33 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
int nlwps = 0;
const struct kinfo_lwp* klwps = kvm_getlwps(this->kd, kproc->p_pid, kproc->p_paddr, sizeof(struct kinfo_lwp), &nlwps);
+ /* TODO: According to the link below, SDYING should be a regarded state */
+ /* Taken from: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/proc.h */
switch (kproc->p_realstat) {
- case SIDL: proc->state = 'I'; break;
+ case SIDL: proc->state = IDLE; break;
case SACTIVE:
// We only consider the first LWP with a one of the below states.
for (int j = 0; j < nlwps; j++) {
if (klwps) {
switch (klwps[j].l_stat) {
- case LSONPROC: proc->state = 'P'; break;
- case LSRUN: proc->state = 'R'; break;
- case LSSLEEP: proc->state = 'S'; break;
- case LSSTOP: proc->state = 'T'; break;
- default: proc->state = '?';
+ case LSONPROC: proc->state = RUNNING; break;
+ case LSRUN: proc->state = RUNNABLE; break;
+ case LSSLEEP: proc->state = SLEEPING; break;
+ case LSSTOP: proc->state = STOPPED; break;
+ default: proc->state = UNKNOWN;
}
- if (proc->state != '?')
+ if (proc->state != UNKNOWN)
break;
} else {
- proc->state = '?';
+ proc->state = UNKNOWN;
break;
}
}
break;
- case SSTOP: proc->state = 'T'; break;
- case SZOMB: proc->state = 'Z'; break;
- case SDEAD: proc->state = 'D'; break;
- default: proc->state = '?';
+ case SSTOP: proc->state = STOPPED; break;
+ case SZOMB: proc->state = ZOMBIE; break;
+ case SDEAD: proc->state = DEFUNCT; break;
+ default: proc->state = UNKNOWN;
}
if (Process_isKernelThread(proc)) {
@@ -365,8 +367,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
}
this->super.totalTasks++;
- // SRUN ('R') means runnable, not running
- if (proc->state == 'P') {
+ if (proc->state == RUNNING) {
this->super.runningTasks++;
}
proc->updated = true;

© 2014-2022 Faster IT GmbH | imprint | privacy policy