mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-13 04:34:35 +03:00
Move kernel/userland thread handling to platform-independent implementation
This commit is contained in:
@ -96,10 +96,6 @@ static int FreeBSDProcess_compareByKey(const Process* v1, const Process* v2, Pro
|
||||
}
|
||||
}
|
||||
|
||||
bool Process_isThread(const Process* this) {
|
||||
return Process_isKernelThread(this) || Process_isUserlandThread(this);
|
||||
}
|
||||
|
||||
const ProcessClass FreeBSDProcess_class = {
|
||||
.super = {
|
||||
.extends = Class(Process),
|
||||
|
@ -16,19 +16,10 @@ in the source distribution for its full text.
|
||||
|
||||
typedef struct FreeBSDProcess_ {
|
||||
Process super;
|
||||
bool isKernelThread;
|
||||
int jid;
|
||||
char* jname;
|
||||
} FreeBSDProcess;
|
||||
|
||||
static inline bool Process_isKernelThread(const Process* this) {
|
||||
return ((const FreeBSDProcess*)this)->isKernelThread;
|
||||
}
|
||||
|
||||
static inline bool Process_isUserlandThread(const Process* this) {
|
||||
return this->pid != this->tgid;
|
||||
}
|
||||
|
||||
extern const ProcessClass FreeBSDProcess_class;
|
||||
|
||||
extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD];
|
||||
@ -37,6 +28,4 @@ Process* FreeBSDProcess_new(const Settings* settings);
|
||||
|
||||
void Process_delete(Object* cast);
|
||||
|
||||
bool Process_isThread(const Process* this);
|
||||
|
||||
#endif
|
||||
|
@ -456,7 +456,8 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
||||
if (!preExisting) {
|
||||
fp->jid = kproc->ki_jid;
|
||||
proc->pid = kproc->ki_pid;
|
||||
fp->isKernelThread = kproc->ki_pid != 0 && kproc->ki_pid != 1 && (kproc->ki_flag & P_SYSTEM);
|
||||
proc->isKernelThread = kproc->ki_pid != 0 && kproc->ki_pid != 1 && (kproc->ki_flag & P_SYSTEM);
|
||||
proc->isUserlandThread = false;
|
||||
proc->ppid = kproc->ki_ppid;
|
||||
proc->tpgid = kproc->ki_tpgid;
|
||||
proc->tgid = kproc->ki_pid;
|
||||
|
Reference in New Issue
Block a user