diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-11-23 22:55:56 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-11-24 19:05:48 +0100 |
commit | 21e3063e2edec4f7cbcf9188aa85ac20cd082939 (patch) | |
tree | 4a23fd0f9043bf4c5958ec396820f17f41f03646 /linux/LinuxProcess.c | |
parent | ec36c5ccf8560028bf274bd4b0ce54969681dbc5 (diff) |
Include comm before cmdline if exe could not be read, but comm mismatches basename from cmdline
Also highlights entries where exe was marked deleted
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r-- | linux/LinuxProcess.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index a65688c5..3eaa6cbe 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -399,16 +399,33 @@ void LinuxProcess_makeCommandStr(Process* this) { int cmdlineBasenameOffset = lp->procCmdlineBasenameOffset; if (!showMergedCommand || !procExe || !procComm) { /* fall back to cmdline */ + if (showMergedCommand && !procExe && procComm && strlen(procComm)) { /* Prefix column with comm */ + if (strncmp(cmdline + cmdlineBasenameOffset, procComm, MINIMUM(TASK_COMM_LEN - 1, strlen(procComm))) != 0) { + mc->commStart = 0; + mc->commEnd = strlen(procComm); + + str = stpcpy(str, procComm); + + mc->sep1 = str - strStart; + str = stpcpy(str, SEPARATOR); + } + } + if (showProgramPath) { - (void) stpcpyWithNewlineConversion(strStart, cmdline); + (void) stpcpyWithNewlineConversion(str, cmdline); mc->baseStart = cmdlineBasenameOffset; mc->baseEnd = lp->procCmdlineBasenameEnd; } else { - (void) stpcpyWithNewlineConversion(strStart, cmdline + cmdlineBasenameOffset); + (void) stpcpyWithNewlineConversion(str, cmdline + cmdlineBasenameOffset); mc->baseStart = 0; mc->baseEnd = lp->procCmdlineBasenameEnd - cmdlineBasenameOffset; } + if (mc->sep1) { + mc->baseStart += str - strStart - SEPARATOR_LEN + 1; + mc->baseEnd += str - strStart - SEPARATOR_LEN + 1; + } + return; } @@ -520,6 +537,9 @@ static void LinuxProcess_writeCommand(const Process* this, int attr, int baseAtt bool highlightBaseName = this->settings->highlightBaseName; + if(lp->procExeDeleted) + baseAttr = CRT_colors[FAILED_READ]; + RichString_append(str, attr, lp->mergedCommand.str); if (lp->mergedCommand.commEnd) { @@ -716,6 +736,8 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces case PROC_EXE: { if (lp->procExe) { attr = CRT_colors[Process_isUserlandThread(this) ? PROCESS_THREAD_BASENAME : PROCESS_BASENAME]; + if (lp->procExeDeleted) + attr = CRT_colors[FAILED_READ]; xSnprintf(buffer, n, "%-15.15s ", lp->procExe + lp->procExeBasenameOffset); } else { attr = CRT_colors[PROCESS_SHADOW]; |