diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-25 15:26:05 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-03-25 15:26:05 -0300 |
commit | 47cf1532b0c9fbc70bada5022a7db07d3cc4811a (patch) | |
tree | 88c4e496a5c18cff0c6dd6027ab9c2c5147034e3 /linux/LinuxProcess.h | |
parent | dc050e8088e140d63865f058fa4b926c3571b783 (diff) |
Linux: change how kernel threads are detected
Use the same method that ps and top use to determine if a
process is a kernel thread on Linux: check if cmdline is empty.
Thanks to @wangqr's investigation reported here:
https://github.com/hishamhm/htop/issues/761#issuecomment-375306069
Fixes #761.
Diffstat (limited to 'linux/LinuxProcess.h')
-rw-r--r-- | linux/LinuxProcess.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 9400d7be..d75fe89d 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -85,6 +85,7 @@ typedef enum LinuxProcessFields { typedef struct LinuxProcess_ { Process super; + bool isKernelThread; IOPriority ioPriority; unsigned long int cminflt; unsigned long int cmajflt; @@ -134,7 +135,7 @@ typedef struct LinuxProcess_ { } LinuxProcess; #ifndef Process_isKernelThread -#define Process_isKernelThread(_process) (_process->pgrp == 0) +#define Process_isKernelThread(_process) (((LinuxProcess*)(_process))->isKernelThread) #endif #ifndef Process_isUserlandThread |