summaryrefslogtreecommitdiffstats
path: root/netbsd
diff options
context:
space:
mode:
authorfraggerfox <santhosh.raju@gmail.com>2021-04-27 17:19:35 +0530
committerBenBE <BenBE@geshi.org>2021-06-26 12:18:37 +0200
commitfa65c30976386460d1361950ecce63e81dfb1bea (patch)
tree6b1b12eb9dbdcecb329ace31c838a343c56248cd /netbsd
parent3770769ed1b52052106274e3fe8c229b24b02553 (diff)
Sets a non-NULL process state in case of kvm_getlwps(3) returns NULL. Thanks @cgzone.
Diffstat (limited to 'netbsd')
-rw-r--r--netbsd/NetBSDProcessList.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c
index cfc00d53..91be9549 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessList.c
@@ -212,21 +212,24 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
switch (kproc->p_realstat) {
case SIDL: proc->state = 'I'; 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 = '?';
+ // 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 = '?';
+ }
+ if (proc->state != '?')
+ break;
+ } else {
+ proc->state = '?';
+ break;
}
- if (proc->state != '?')
- break;
- }
- }
- break;
+ }
+ break;
case SSTOP: proc->state = 'T'; break;
case SZOMB: proc->state = 'Z'; break;
case SDEAD: proc->state = 'D'; break;

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