Move kernel/userland thread handling to platform-independent implementation

This commit is contained in:
Benny Baumann
2021-04-10 14:08:26 +02:00
committed by BenBE
parent 1a1fddae85
commit 7224d0e083
19 changed files with 49 additions and 106 deletions

View File

@ -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);
}

View File

@ -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

View File

@ -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);