mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
FreeBSD: simplify kernel thread logic
This commit is contained in:
parent
56c4055fd1
commit
399add39ca
@ -110,13 +110,7 @@ static int FreeBSDProcess_compareByKey(const Process* v1, const Process* v2, Pro
|
||||
}
|
||||
|
||||
bool Process_isThread(const Process* this) {
|
||||
const FreeBSDProcess* fp = (const FreeBSDProcess*) this;
|
||||
|
||||
if (fp->kernel == 1 ) {
|
||||
return 1;
|
||||
} else {
|
||||
return Process_isUserlandThread(this);
|
||||
}
|
||||
return Process_isKernelThread(this) || Process_isUserlandThread(this);
|
||||
}
|
||||
|
||||
const ProcessClass FreeBSDProcess_class = {
|
||||
|
@ -20,14 +20,14 @@ extern const char* const nodevStr;
|
||||
|
||||
typedef struct FreeBSDProcess_ {
|
||||
Process super;
|
||||
int kernel;
|
||||
bool isKernelThread;
|
||||
int jid;
|
||||
char* jname;
|
||||
const char* ttyPath;
|
||||
} FreeBSDProcess;
|
||||
|
||||
static inline bool Process_isKernelThread(const Process* this) {
|
||||
return ((const FreeBSDProcess*)this)->kernel == 1;
|
||||
return ((const FreeBSDProcess*)this)->isKernelThread;
|
||||
}
|
||||
|
||||
static inline bool Process_isUserlandThread(const Process* this) {
|
||||
|
@ -485,11 +485,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||
if (!preExisting) {
|
||||
fp->jid = kproc->ki_jid;
|
||||
proc->pid = kproc->ki_pid;
|
||||
if ( ! ((kproc->ki_pid == 0) || (kproc->ki_pid == 1) ) && kproc->ki_flag & P_SYSTEM) {
|
||||
fp->kernel = 1;
|
||||
} else {
|
||||
fp->kernel = 0;
|
||||
}
|
||||
fp->isKernelThread = kproc->ki_pid != 0 && kproc->ki_pid != 1 && (kproc->ki_flag & P_SYSTEM);
|
||||
proc->ppid = kproc->ki_ppid;
|
||||
proc->tpgid = kproc->ki_tpgid;
|
||||
proc->tgid = kproc->ki_pid;
|
||||
|
Loading…
Reference in New Issue
Block a user