mirror of https://github.com/xzeldon/htop.git
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) {
|
bool Process_isThread(const Process* this) {
|
||||||
const FreeBSDProcess* fp = (const FreeBSDProcess*) this;
|
return Process_isKernelThread(this) || Process_isUserlandThread(this);
|
||||||
|
|
||||||
if (fp->kernel == 1 ) {
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return Process_isUserlandThread(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ProcessClass FreeBSDProcess_class = {
|
const ProcessClass FreeBSDProcess_class = {
|
||||||
|
|
|
@ -20,14 +20,14 @@ extern const char* const nodevStr;
|
||||||
|
|
||||||
typedef struct FreeBSDProcess_ {
|
typedef struct FreeBSDProcess_ {
|
||||||
Process super;
|
Process super;
|
||||||
int kernel;
|
bool isKernelThread;
|
||||||
int jid;
|
int jid;
|
||||||
char* jname;
|
char* jname;
|
||||||
const char* ttyPath;
|
const char* ttyPath;
|
||||||
} FreeBSDProcess;
|
} FreeBSDProcess;
|
||||||
|
|
||||||
static inline bool Process_isKernelThread(const Process* this) {
|
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) {
|
static inline bool Process_isUserlandThread(const Process* this) {
|
||||||
|
|
|
@ -485,11 +485,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||||
if (!preExisting) {
|
if (!preExisting) {
|
||||||
fp->jid = kproc->ki_jid;
|
fp->jid = kproc->ki_jid;
|
||||||
proc->pid = kproc->ki_pid;
|
proc->pid = kproc->ki_pid;
|
||||||
if ( ! ((kproc->ki_pid == 0) || (kproc->ki_pid == 1) ) && kproc->ki_flag & P_SYSTEM) {
|
fp->isKernelThread = kproc->ki_pid != 0 && kproc->ki_pid != 1 && (kproc->ki_flag & P_SYSTEM);
|
||||||
fp->kernel = 1;
|
|
||||||
} else {
|
|
||||||
fp->kernel = 0;
|
|
||||||
}
|
|
||||||
proc->ppid = kproc->ki_ppid;
|
proc->ppid = kproc->ki_ppid;
|
||||||
proc->tpgid = kproc->ki_tpgid;
|
proc->tpgid = kproc->ki_tpgid;
|
||||||
proc->tgid = kproc->ki_pid;
|
proc->tgid = kproc->ki_pid;
|
||||||
|
|
Loading…
Reference in New Issue