Unify function argument names

Name first argument of ProcessList_goThroughEntries consistently super
Name first argument of ProcessList_new consistently userTable
This commit is contained in:
Christian Göttsche 2020-10-27 21:26:28 +01:00 committed by cgzones
parent cf1a9ec180
commit 61bae4c9d2
9 changed files with 41 additions and 41 deletions

View File

@ -72,9 +72,9 @@ typedef struct ProcessList_ {
} ProcessList;
ProcessList* ProcessList_new(UsersTable* ut, Hashtable* pidMatchList, uid_t userId);
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* pl);
void ProcessList_goThroughEntries(ProcessList* pl, bool pauseProcessUpdate);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);

View File

@ -360,14 +360,14 @@ char* DragonFlyBSDProcessList_readJailName(DragonFlyBSDProcessList* dfpl, int ja
return jname;
}
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
DragonFlyBSDProcessList* dfpl = (DragonFlyBSDProcessList*) this;
const Settings* settings = this->settings;
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
DragonFlyBSDProcessList* dfpl = (DragonFlyBSDProcessList*) super;
const Settings* settings = super->settings;
bool hideKernelThreads = settings->hideKernelThreads;
bool hideUserlandThreads = settings->hideUserlandThreads;
DragonFlyBSDProcessList_scanMemoryInfo(this);
DragonFlyBSDProcessList_scanCPUTime(this);
DragonFlyBSDProcessList_scanMemoryInfo(super);
DragonFlyBSDProcessList_scanCPUTime(super);
DragonFlyBSDProcessList_scanJails(dfpl);
// in pause mode only gather global data for meters (CPU/memory/...)
@ -385,7 +385,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
bool ATTR_UNUSED isIdleProcess = false;
// note: dragonflybsd kernel processes all have the same pid, so we misuse the kernel thread address to give them a unique identifier
Process* proc = ProcessList_getProcess(this, kproc->kp_ktaddr ? (pid_t)kproc->kp_ktaddr : kproc->kp_pid, &preExisting, DragonFlyBSDProcess_new);
Process* proc = ProcessList_getProcess(super, kproc->kp_ktaddr ? (pid_t)kproc->kp_ktaddr : kproc->kp_pid, &preExisting, DragonFlyBSDProcess_new);
DragonFlyBSDProcess* dfp = (DragonFlyBSDProcess*) proc;
proc->show = ! ((hideKernelThreads && Process_isKernelThread(dfp)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
@ -410,9 +410,9 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
proc->st_uid = kproc->kp_uid; // user ID
proc->processor = kproc->kp_lwp.kl_origcpu;
proc->starttime_ctime = kproc->kp_start.tv_sec;
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
ProcessList_add((ProcessList*)this, proc);
ProcessList_add(super, proc);
proc->comm = DragonFlyBSDProcessList_readProcessName(dfpl->kd, kproc, &proc->basenameOffset);
dfp->jname = DragonFlyBSDProcessList_readJailName(dfpl, kproc->kp_jailid);
} else {
@ -427,7 +427,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
}
if(proc->st_uid != kproc->kp_uid) { // some processes change users (eg. to lower privs)
proc->st_uid = kproc->kp_uid;
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
}
if (settings->updateProcessNames) {
free(proc->comm);
@ -441,7 +441,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
proc->time = (kproc->kp_swtime + 5000) / 10000;
proc->percent_cpu = 100.0 * ((double)kproc->kp_lwp.kl_pctcpu / (double)kernelFScale);
proc->percent_mem = 100.0 * (proc->m_resident * pageSizeKb) / (double)(this->totalMem);
proc->percent_mem = 100.0 * (proc->m_resident * pageSizeKb) / (double)(super->totalMem);
if (proc->percent_cpu > 0.1) {
// system idle process should own all CPU time left regardless of CPU count
@ -523,12 +523,12 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
}
if (Process_isKernelThread(dfp)) {
this->kernelThreads++;
super->kernelThreads++;
}
this->totalTasks++;
super->totalTasks++;
if (proc->state == 'R')
this->runningTasks++;
super->runningTasks++;
proc->updated = true;
}
}

View File

@ -59,6 +59,6 @@ char* DragonFlyBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kpro
char* DragonFlyBSDProcessList_readJailName(DragonFlyBSDProcessList* dfpl, int jailid);
void ProcessList_goThroughEntries(ProcessList* this, pauseProcessUpdate);
void ProcessList_goThroughEntries(ProcessList* super, pauseProcessUpdate);
#endif

View File

@ -380,15 +380,15 @@ IGNORE_WCASTQUAL_END
return jname;
}
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
FreeBSDProcessList* fpl = (FreeBSDProcessList*) this;
const Settings* settings = this->settings;
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
FreeBSDProcessList* fpl = (FreeBSDProcessList*) super;
const Settings* settings = super->settings;
bool hideKernelThreads = settings->hideKernelThreads;
bool hideUserlandThreads = settings->hideUserlandThreads;
openzfs_sysctl_updateArcStats(&fpl->zfs);
FreeBSDProcessList_scanMemoryInfo(this);
FreeBSDProcessList_scanCPUTime(this);
FreeBSDProcessList_scanMemoryInfo(super);
FreeBSDProcessList_scanCPUTime(super);
// in pause mode only gather global data for meters (CPU/memory/...)
if (pauseProcessUpdate)
@ -401,7 +401,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
struct kinfo_proc* kproc = &kprocs[i];
bool preExisting = false;
// TODO: bool isIdleProcess = false;
Process* proc = ProcessList_getProcess(this, kproc->ki_pid, &preExisting, FreeBSDProcess_new);
Process* proc = ProcessList_getProcess(super, kproc->ki_pid, &preExisting, FreeBSDProcess_new);
FreeBSDProcess* fp = (FreeBSDProcess*) proc;
proc->show = ! ((hideKernelThreads && Process_isKernelThread(fp)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
@ -422,8 +422,8 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
proc->st_uid = kproc->ki_uid;
proc->starttime_ctime = kproc->ki_start.tv_sec;
Process_fillStarttimeBuffer(proc);
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
ProcessList_add((ProcessList*)this, proc);
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
ProcessList_add(super, proc);
proc->comm = FreeBSDProcessList_readProcessName(fpl->kd, kproc, &proc->basenameOffset);
fp->jname = FreeBSDProcessList_readJailName(kproc);
} else {
@ -440,7 +440,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
if(proc->st_uid != kproc->ki_uid) {
// some processes change users (eg. to lower privs)
proc->st_uid = kproc->ki_uid;
proc->user = UsersTable_getRef(this->usersTable, proc->st_uid);
proc->user = UsersTable_getRef(super->usersTable, proc->st_uid);
}
if (settings->updateProcessNames) {
free(proc->comm);
@ -455,7 +455,7 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
proc->time = (kproc->ki_runtime + 5000) / 10000;
proc->percent_cpu = 100.0 * ((double)kproc->ki_pctcpu / (double)kernelFScale);
proc->percent_mem = 100.0 * (proc->m_resident * pageSizeKb) / (double)(this->totalMem);
proc->percent_mem = 100.0 * (proc->m_resident * pageSizeKb) / (double)(super->totalMem);
/*
* TODO
@ -491,12 +491,12 @@ void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
}
if (Process_isKernelThread(fp)) {
this->kernelThreads++;
super->kernelThreads++;
}
this->totalTasks++;
super->totalTasks++;
if (proc->state == 'R')
this->runningTasks++;
super->runningTasks++;
proc->updated = true;
}
}

View File

@ -62,6 +62,6 @@ char* FreeBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
char* FreeBSDProcessList_readJailName(struct kinfo_proc* kproc);
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
#endif

View File

@ -340,10 +340,10 @@ static void OpenBSDProcessList_scanCPUTime(OpenBSDProcessList* this) {
kernelCPUTimesToHtop(avg, this->cpus);
}
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
OpenBSDProcessList* opl = (OpenBSDProcessList*) this;
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
OpenBSDProcessList* opl = (OpenBSDProcessList*) super;
OpenBSDProcessList_scanMemoryInfo(this);
OpenBSDProcessList_scanMemoryInfo(super);
OpenBSDProcessList_scanCPUTime(opl);
// in pause mode only gather global data for meters (CPU/memory/...)

View File

@ -45,6 +45,6 @@ void ProcessList_delete(ProcessList* this);
char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
#endif

View File

@ -377,15 +377,15 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
return 0;
}
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate) {
SolarisProcessList_scanCPUTime(this);
SolarisProcessList_scanMemoryInfo(this);
SolarisProcessList_scanZfsArcstats(this);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
SolarisProcessList_scanCPUTime(super);
SolarisProcessList_scanMemoryInfo(super);
SolarisProcessList_scanZfsArcstats(super);
// in pause mode only gather global data for meters (CPU/memory/...)
if (pauseProcessUpdate)
return;
this->kernelThreads = 1;
proc_walk(&SolarisProcessList_walkproc, this, PR_WALK_LWP);
super->kernelThreads = 1;
proc_walk(&SolarisProcessList_walkproc, super, PR_WALK_LWP);
}

View File

@ -60,6 +60,6 @@ void ProcessList_delete(ProcessList* pl);
int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *listptr);
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
#endif