mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 04:04:35 +03:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user