diff --git a/Process.h b/Process.h index 6c723178..96b90bce 100644 --- a/Process.h +++ b/Process.h @@ -105,6 +105,9 @@ typedef struct Process_ { /* Offset in cmdline of the process basename */ int cmdlineBasenameOffset; + /* Start Offset in cmdline of the process basename */ + int cmdlineBasenameStart; + /* The process' "command" name */ char *procComm; diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 614deb4f..8fef153d 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -391,7 +391,7 @@ void LinuxProcess_makeCommandStr(Process* this) { char *strStart = mc->str; char *str = strStart; - int cmdlineBasenameOffset = lp->procCmdlineBasenameOffset; + int cmdlineBasenameOffset = this->cmdlineBasenameStart; int cmdlineBasenameEnd = this->cmdlineBasenameOffset; if (!cmdline) { diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 1f61651f..443e33c1 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -63,7 +63,6 @@ typedef struct LinuxProcessMergedCommand_ { typedef struct LinuxProcess_ { Process super; - int procCmdlineBasenameOffset; LinuxProcessMergedCommand mergedCommand; bool isKernelThread; IOPriority ioPriority; diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index 128b0a27..047097af 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1134,7 +1134,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc lp->mergedCommand.maxLen = lastChar + 1; /* accommodate cmdline */ if (!process->cmdline || !String_eq(command, process->cmdline)) { free_and_xStrdup(&process->cmdline, command); - lp->procCmdlineBasenameOffset = tokenStart; + process->cmdlineBasenameStart = tokenStart; process->cmdlineBasenameOffset = tokenEnd; lp->mergedCommand.cmdlineChanged = true; } @@ -1463,13 +1463,13 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_ if (proc->state == 'Z' && (proc->cmdlineBasenameOffset == 0)) { proc->cmdlineBasenameOffset = -1; free_and_xStrdup(&proc->cmdline, command); - lp->procCmdlineBasenameOffset = 0; + proc->cmdlineBasenameStart = 0; lp->mergedCommand.commChanged = true; } else if (Process_isThread(proc)) { if (settings->showThreadNames || Process_isKernelThread(proc)) { proc->cmdlineBasenameOffset = -1; free_and_xStrdup(&proc->cmdline, command); - lp->procCmdlineBasenameOffset = 0; + proc->cmdlineBasenameStart = 0; lp->mergedCommand.commChanged = true; }