aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/004_fix_ktread_display.patch
blob: 8fff974ee7ee06270176a42e6e462f49d5f75f7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 71b099a8df9e8c2bf4361a9a93bebc409f513460 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Sat, 27 Jan 2024 23:22:31 +0100
Subject: [PATCH] Disable basename matching for kernel threads

Kernel threads are commonly not based on an executable and their cmdline
therefore just a human readable string.
On Linux this string might contain slashes, e.g. kworker/7:5H-ttm, which
cause Process_writeCommand() to print only the trailing parts if the
option *Show Program Path* is disabled.

Reported-and-Suggested-By: mmrmaximuzz
---
 Process.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/Process.c b/Process.c
index 1497503f0..9179c0eaf 100644
--- a/Process.c
+++ b/Process.c
@@ -1038,8 +1038,14 @@ void Process_updateCmdline(Process* this, const char* cmdline, int basenameStart
 
    free(this->cmdline);
    this->cmdline = cmdline ? xStrdup(cmdline) : NULL;
-   this->cmdlineBasenameStart = (basenameStart || !cmdline) ? basenameStart : skipPotentialPath(cmdline, basenameEnd);
-   this->cmdlineBasenameEnd = basenameEnd;
+   if (Process_isKernelThread(this)) {
+      /* kernel threads have no basename */
+      this->cmdlineBasenameStart = 0;
+      this->cmdlineBasenameEnd = 0;
+   } else {
+      this->cmdlineBasenameStart = (basenameStart || !cmdline) ? basenameStart : skipPotentialPath(cmdline, basenameEnd);
+      this->cmdlineBasenameEnd = basenameEnd;
+   }
 
    this->mergedCommand.lastUpdate = 0;
 }

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