mirror of https://github.com/xzeldon/htop.git
correct thread detection
This commit is contained in:
parent
831538b0f9
commit
941ad72f67
|
@ -557,13 +557,10 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
|
||||||
if (parent && pid == parent->pid)
|
if (parent && pid == parent->pid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool isThread = parent;
|
|
||||||
// The RedHat kernel hides threads with a dot.
|
// The RedHat kernel hides threads with a dot.
|
||||||
// I believe this is non-standard.
|
// I believe this is non-standard.
|
||||||
if ((!this->hideThreads) && pid == 0 && name[0] == '.') {
|
if ((!this->hideThreads) && pid == 0 && name[0] == '.') {
|
||||||
char* tname = name + 1;
|
pid = atoi(name + 1);
|
||||||
pid = atoi(tname);
|
|
||||||
isThread = true;
|
|
||||||
}
|
}
|
||||||
if (pid <= 0)
|
if (pid <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -593,7 +590,6 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
|
||||||
if (! ProcessList_readStatmFile(process, dirname, name))
|
if (! ProcessList_readStatmFile(process, dirname, name))
|
||||||
goto errorReadingProcess;
|
goto errorReadingProcess;
|
||||||
|
|
||||||
isThread = Process_isThread(process);
|
|
||||||
process->show = ! ((hideKernelThreads && Process_isKernelThread(process)) || (hideUserlandThreads && Process_isUserlandThread(process)));
|
process->show = ! ((hideKernelThreads && Process_isKernelThread(process)) || (hideUserlandThreads && Process_isUserlandThread(process)));
|
||||||
|
|
||||||
char command[MAX_NAME+1];
|
char command[MAX_NAME+1];
|
||||||
|
@ -629,7 +625,7 @@ static bool ProcessList_processEntries(ProcessList* this, const char* dirname, P
|
||||||
ProcessList_add(this, process);
|
ProcessList_add(this, process);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isThread) {
|
if (Process_isThread(process)) {
|
||||||
if (this->showThreadNames || Process_isKernelThread(process) || process->state == 'Z') {
|
if (this->showThreadNames || Process_isKernelThread(process) || process->state == 'Z') {
|
||||||
free(process->comm);
|
free(process->comm);
|
||||||
process->comm = String_copy(command);
|
process->comm = String_copy(command);
|
||||||
|
|
Loading…
Reference in New Issue