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:
@ -234,7 +234,3 @@ const ProcessClass OpenBSDProcess_class = {
|
||||
.writeField = OpenBSDProcess_writeField,
|
||||
.compareByKey = OpenBSDProcess_compareByKey
|
||||
};
|
||||
|
||||
bool Process_isThread(const Process* this) {
|
||||
return Process_isKernelThread(this) || Process_isUserlandThread(this);
|
||||
}
|
||||
|
@ -22,14 +22,6 @@ typedef struct OpenBSDProcess_ {
|
||||
uint64_t addr;
|
||||
} OpenBSDProcess;
|
||||
|
||||
static inline bool Process_isKernelThread(const Process* this) {
|
||||
return this->pgrp == 0;
|
||||
}
|
||||
|
||||
static inline bool Process_isUserlandThread(const Process* this) {
|
||||
return this->pid != this->tgid;
|
||||
}
|
||||
|
||||
extern const ProcessClass OpenBSDProcess_class;
|
||||
|
||||
extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD];
|
||||
@ -38,6 +30,4 @@ Process* OpenBSDProcess_new(const Settings* settings);
|
||||
|
||||
void Process_delete(Object* cast);
|
||||
|
||||
bool Process_isThread(const Process* this);
|
||||
|
||||
#endif
|
||||
|
@ -252,6 +252,8 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
|
||||
proc->tgid = kproc->p_pid;
|
||||
proc->session = kproc->p_sid;
|
||||
proc->pgrp = kproc->p__pgid;
|
||||
proc->isKernelThread = proc->pgrp == 0;
|
||||
proc->isUserlandThread = kproc->p_tid != -1;
|
||||
proc->st_uid = kproc->p_uid;
|
||||
proc->starttime_ctime = kproc->p_ustart_sec;
|
||||
Process_fillStarttimeBuffer(proc);
|
||||
|
Reference in New Issue
Block a user