mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-24 15:15:44 +00:00
Use proper metric to detect kernel threads
Querying kernel threads with `ps -o pid,lid,flags,state,lname -sp 0` gives that kernel threads have state `K` and flags have mask `0x20000` set. This corresponds to `LW_SYSTEM` in kernel which is mapped as `L_SYSTEM`/`P_SYSTEM` for userspace.
This commit is contained in:
parent
68123adb6f
commit
b42c441ee0
@ -281,7 +281,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
|
||||
proc->session = kproc->p_sid;
|
||||
proc->tty_nr = kproc->p_tdev;
|
||||
proc->pgrp = kproc->p__pgid;
|
||||
proc->isKernelThread = proc->pgrp == 0;
|
||||
proc->isKernelThread = !!(kproc->p_flag & P_SYSTEM);
|
||||
proc->isUserlandThread = proc->pid != proc->tgid;
|
||||
proc->starttime_ctime = kproc->p_ustart_sec;
|
||||
Process_fillStarttimeBuffer(proc);
|
||||
|
Loading…
Reference in New Issue
Block a user