Darwin: Always update username

This commit is contained in:
Benny Baumann 2021-06-18 20:42:04 +02:00 committed by BenBE
parent 8aca6fbfbd
commit 6a6b09b431
2 changed files with 5 additions and 3 deletions

View File

@ -298,7 +298,6 @@ void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps,
proc->tgid = proc->pid;
proc->isKernelThread = false;
proc->isUserlandThread = false;
proc->st_uid = ps->kp_eproc.e_ucred.cr_uid;
dp->translated = ps->kp_proc.p_flag & P_TRANSLATED;
proc->tty_nr = ps->kp_eproc.e_tdev;

View File

@ -213,6 +213,11 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
DarwinProcess_setFromKInfoProc(&proc->super, &ps[i], preExisting);
DarwinProcess_setFromLibprocPidinfo(proc, dpl, time_interval);
if (proc->super.st_uid != ps[i].kp_eproc.e_ucred.cr_uid) {
proc->super.st_uid = ps[i].kp_eproc.e_ucred.cr_uid;
proc->super.user = UsersTable_getRef(super->usersTable, proc->super.st_uid);
}
// Disabled for High Sierra due to bug in macOS High Sierra
bool isScanThreadSupported = ! ( CompareKernelVersion(17, 0, 0) >= 0 && CompareKernelVersion(17, 5, 0) < 0);
@ -223,8 +228,6 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
super->totalTasks += 1;
if (!preExisting) {
proc->super.user = UsersTable_getRef(super->usersTable, proc->super.st_uid);
ProcessList_add(super, &proc->super);
}
}