Always update `proc->st_uid` + `proc->user`

Avoids issue #661.
This commit is contained in:
BenBE 2021-06-18 12:53:23 +02:00
parent 686309e34c
commit 3bed682b1e
1 changed files with 5 additions and 2 deletions

View File

@ -236,10 +236,8 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
proc->pgrp = kproc->p__pgid;
proc->isKernelThread = proc->pgrp == 0;
proc->isUserlandThread = proc->pid != proc->tgid;
proc->st_uid = kproc->p_uid;
proc->starttime_ctime = kproc->p_ustart_sec;
Process_fillStarttimeBuffer(proc);
proc->user = UsersTable_getRef(this->super.usersTable, proc->st_uid);
ProcessList_add(&this->super, proc);
NetBSDProcessList_updateExe(kproc, proc);
@ -254,6 +252,11 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
NetBSDProcessList_updateCwd(kproc, proc);
}
if (proc->st_uid != kproc->p_uid) {
proc->st_uid = kproc->p_uid;
proc->user = UsersTable_getRef(this->super.usersTable, proc->st_uid);
}
proc->m_virt = kproc->p_vm_vsize;
proc->m_resident = kproc->p_vm_rssize;
proc->percent_mem = (proc->m_resident * pageSizeKB) / (double)(this->super.totalMem) * 100.0;