diff options
author | Hisham <hisham@gobolinux.org> | 2016-02-19 20:51:57 -0200 |
---|---|---|
committer | Hisham <hisham@gobolinux.org> | 2016-02-19 20:51:57 -0200 |
commit | baec4bdcb083eb76259737bb7e83323373a1d910 (patch) | |
tree | 37a1297e71a94964fe2707e1b5b32d3049e584a9 /linux | |
parent | a8a5e62760f3a60311c4c5f7f6e45689c1ef540e (diff) |
Try to retain last full name of a zombie process.
Once a process goes zombie on Linux, /proc/PID/cmdline
gets empty. So, when we detect it is a zombie we stop
reading this file.
For processes that were zombies before htop started,
there's no way to get the full name.
Closes #49.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/LinuxProcessList.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index dd03e55c..0f132764 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -585,7 +585,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* ProcessList_add(pl, proc); } else { - if (settings->updateProcessNames) { + if (settings->updateProcessNames && proc->state != 'Z') { if (! LinuxProcessList_readCmdlineFile(proc, dirname, name)) { goto errorReadingProcess; } @@ -600,11 +600,11 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char* if (settings->flags & PROCESS_FLAG_LINUX_OOM) LinuxProcessList_readOomData(lp, dirname, name); - if (proc->state == 'Z') { + if (proc->state == 'Z' && (proc->basenameOffset == 0)) { proc->basenameOffset = -1; setCommand(proc, command, commLen); } else if (Process_isThread(proc)) { - if (settings->showThreadNames || Process_isKernelThread(proc) || proc->state == 'Z') { + if (settings->showThreadNames || Process_isKernelThread(proc) || (proc->state == 'Z' && proc->basenameOffset == 0)) { proc->basenameOffset = -1; setCommand(proc, command, commLen); } else if (settings->showThreadNames) { |