summaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-03-19 19:54:29 +0100
committerChristian Göttsche <cgzones@googlemail.com>2021-03-20 18:30:08 +0100
commit58ad020aca933de5f1e975ccba041ff720261926 (patch)
treec0bec92bc31a861362512444746c94e98b4a1af2 /ProcessList.c
parent70fecb4984510c8ae77101f5909193c148117dce (diff)
ProcessList: fix treeview on OpenBSD when hiding kernel threads
Currently the tree-view is empty on OpenBSD when kernel threads are hidden, cause the kernel thread 'swapper' has pid 0 and gets treated as root of the tree and parent of 'init'. Do not build any tree with a pid 0 root node.
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 37c40bcf..cd8ebd8a 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -311,6 +311,11 @@ static void ProcessList_updateTreeSet(ProcessList* this) {
}
static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level, int indent, int direction, bool show, int* node_counter, int* node_index) {
+ // On OpenBSD the kernel thread 'swapper' has pid 0.
+ // Do not treat it as root of any tree.
+ if (pid == 0)
+ return;
+
Vector* children = Vector_new(Class(Process), false, DEFAULT_SIZE);
for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {

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