mirror of https://github.com/xzeldon/htop.git
Move procExeDeleted flag to main Process structure
This commit is contained in:
parent
b839987df7
commit
93a44acf7e
|
@ -111,6 +111,9 @@ typedef struct Process_ {
|
||||||
/* The main process executable */
|
/* The main process executable */
|
||||||
char *procExe;
|
char *procExe;
|
||||||
|
|
||||||
|
/* Tells if the executable has been replaced in the filesystem since start */
|
||||||
|
bool procExeDeleted;
|
||||||
|
|
||||||
/* CPU number last executed on */
|
/* CPU number last executed on */
|
||||||
int processor;
|
int processor;
|
||||||
|
|
||||||
|
|
|
@ -441,14 +441,14 @@ void LinuxProcess_makeCommandStr(Process* this) {
|
||||||
if (haveCommInExe)
|
if (haveCommInExe)
|
||||||
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM);
|
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM);
|
||||||
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
|
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
|
||||||
if (lp->procExeDeleted)
|
if (this->procExeDeleted)
|
||||||
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED);
|
WRITE_HIGHLIGHT(exeBasenameOffset, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED);
|
||||||
str = stpcpy(str, procExe);
|
str = stpcpy(str, procExe);
|
||||||
} else {
|
} else {
|
||||||
if (haveCommInExe)
|
if (haveCommInExe)
|
||||||
WRITE_HIGHLIGHT(0, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM);
|
WRITE_HIGHLIGHT(0, exeBasenameLen, commAttr, CMDLINE_HIGHLIGHT_FLAG_COMM);
|
||||||
WRITE_HIGHLIGHT(0, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
|
WRITE_HIGHLIGHT(0, exeBasenameLen, baseAttr, CMDLINE_HIGHLIGHT_FLAG_BASENAME);
|
||||||
if (lp->procExeDeleted)
|
if (this->procExeDeleted)
|
||||||
WRITE_HIGHLIGHT(0, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED);
|
WRITE_HIGHLIGHT(0, exeBasenameLen, delAttr, CMDLINE_HIGHLIGHT_FLAG_DELETED);
|
||||||
str = stpcpy(str, procExe + exeBasenameOffset);
|
str = stpcpy(str, procExe + exeBasenameOffset);
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ static void LinuxProcess_writeField(const Process* this, RichString* str, Proces
|
||||||
const char* procExe;
|
const char* procExe;
|
||||||
if (this->procExe) {
|
if (this->procExe) {
|
||||||
attr = CRT_colors[Process_isUserlandThread(this) ? PROCESS_THREAD_BASENAME : PROCESS_BASENAME];
|
attr = CRT_colors[Process_isUserlandThread(this) ? PROCESS_THREAD_BASENAME : PROCESS_BASENAME];
|
||||||
if (lp->procExeDeleted)
|
if (this->procExeDeleted)
|
||||||
attr = CRT_colors[FAILED_READ];
|
attr = CRT_colors[FAILED_READ];
|
||||||
procExe = this->procExe + lp->procExeBasenameOffset;
|
procExe = this->procExe + lp->procExeBasenameOffset;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,7 +65,6 @@ typedef struct LinuxProcess_ {
|
||||||
Process super;
|
Process super;
|
||||||
int procExeLen;
|
int procExeLen;
|
||||||
int procExeBasenameOffset;
|
int procExeBasenameOffset;
|
||||||
bool procExeDeleted;
|
|
||||||
int procCmdlineBasenameOffset;
|
int procCmdlineBasenameOffset;
|
||||||
int procCmdlineBasenameEnd;
|
int procCmdlineBasenameEnd;
|
||||||
LinuxProcessMergedCommand mergedCommand;
|
LinuxProcessMergedCommand mergedCommand;
|
||||||
|
|
|
@ -1178,9 +1178,9 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc
|
||||||
|
|
||||||
const char* deletedMarker = " (deleted)";
|
const char* deletedMarker = " (deleted)";
|
||||||
if (strlen(process->procExe) > strlen(deletedMarker)) {
|
if (strlen(process->procExe) > strlen(deletedMarker)) {
|
||||||
lp->procExeDeleted = String_eq(process->procExe + strlen(process->procExe) - strlen(deletedMarker), deletedMarker);
|
process->procExeDeleted = String_eq(process->procExe + strlen(process->procExe) - strlen(deletedMarker), deletedMarker);
|
||||||
|
|
||||||
if (lp->procExeDeleted && strlen(process->procExe) - strlen(deletedMarker) == 1 && process->procExe[0] == '/') {
|
if (process->procExeDeleted && strlen(process->procExe) - strlen(deletedMarker) == 1 && process->procExe[0] == '/') {
|
||||||
lp->procExeBasenameOffset = 0;
|
lp->procExeBasenameOffset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1190,7 +1190,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc
|
||||||
process->procExe = NULL;
|
process->procExe = NULL;
|
||||||
lp->procExeLen = 0;
|
lp->procExeLen = 0;
|
||||||
lp->procExeBasenameOffset = 0;
|
lp->procExeBasenameOffset = 0;
|
||||||
lp->procExeDeleted = false;
|
process->procExeDeleted = false;
|
||||||
lp->mergedCommand.exeChanged = true;
|
lp->mergedCommand.exeChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue