now that they're available, include userland thread names in htop's display

(either in COMM or in "Command (merged)" if set to show thread names)
This commit is contained in:
sthen 2023-01-07 20:49:39 +00:00
parent d23b038578
commit 9dad6978bd
2 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,7 @@
COMMENT = interactive process viewer
V = 3.2.1
REVISION = 0
DISTNAME = htop-$V
CATEGORIES = sysutils

View File

@ -0,0 +1,20 @@
Include thread names in COMM
Index: openbsd/OpenBSDProcessList.c
--- openbsd/OpenBSDProcessList.c.orig
+++ openbsd/OpenBSDProcessList.c
@@ -211,7 +211,13 @@ static void OpenBSDProcessList_updateCwd(const struct
}
static void OpenBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) {
- Process_updateComm(proc, kproc->p_comm);
+ char buf[50]; /* procname/threadname (each MAXCOMLEN) + NUL */
+ if (kproc->p_name[0] != '\0') {
+ snprintf(buf, sizeof buf, "%s/%s", kproc->p_comm, kproc->p_name);
+ Process_updateComm(proc, buf);
+ } else {
+ Process_updateComm(proc, kproc->p_comm);
+ }
/*
* Like OpenBSD's top(1), we try to fall back to the command name