diff options
author | Nathan Scott <nathans@redhat.com> | 2023-08-31 11:56:43 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2023-08-31 14:13:16 +1000 |
commit | b74673fe37fd379fc350789e696470556776d815 (patch) | |
tree | cbe4f036962c439f9c07a9c96302f5908f6410b0 /openbsd | |
parent | 214166a049c2a6ac454dbb37b85b04c039a6a17a (diff) |
Rename ProcessList to ProcessTable throughout
Following up with some discusson from a few months back,
where it was proposed that ProcessTable is a better name.
This data structure is definitely not a list ... if it
was one-dimensional it'd be a set, but in practice it has
much more in common with a two-dimensional table.
The Process table is a familiar operating system concept
for many people too so it resonates a little in that way
as well.
Diffstat (limited to 'openbsd')
-rw-r--r-- | openbsd/OpenBSDMachine.c | 2 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessTable.c (renamed from openbsd/OpenBSDProcessList.c) | 46 | ||||
-rw-r--r-- | openbsd/OpenBSDProcessTable.h (renamed from openbsd/OpenBSDProcessList.h) | 14 |
3 files changed, 31 insertions, 31 deletions
diff --git a/openbsd/OpenBSDMachine.c b/openbsd/OpenBSDMachine.c index 8b86dfab..c4b6e47e 100644 --- a/openbsd/OpenBSDMachine.c +++ b/openbsd/OpenBSDMachine.c @@ -96,7 +96,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) { Machine_init(super, usersTable, userId); - OpenBSDProcessList_updateCPUcount(this); + OpenBSDProcessTable_updateCPUcount(this); size = sizeof(this->fscale); if (sysctl(fmib, 2, &this->fscale, &size, NULL, 0) < 0 || this->fscale <= 0) { diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessTable.c index 17066397..0b016fbb 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessTable.c @@ -1,12 +1,12 @@ /* -htop - OpenBSDProcessList.c +htop - OpenBSDProcessTable.c (C) 2014 Hisham H. Muhammad (C) 2015 Michael McConville Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ -#include "openbsd/OpenBSDProcessList.h" +#include "openbsd/OpenBSDProcessTable.h" #include <kvm.h> #include <limits.h> @@ -25,30 +25,30 @@ in the source distribution for its full text. #include "Macros.h" #include "Object.h" #include "Process.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "Settings.h" #include "XUtils.h" #include "openbsd/OpenBSDMachine.h" #include "openbsd/OpenBSDProcess.h" -ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) { - OpenBSDProcessList* this = xCalloc(1, sizeof(OpenBSDProcessList)); - Object_setClass(this, Class(ProcessList)); +ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) { + OpenBSDProcessTable* this = xCalloc(1, sizeof(OpenBSDProcessTable)); + Object_setClass(this, Class(ProcessTable)); - ProcessList* super = &this->super; - ProcessList_init(super, Class(OpenBSDProcess), host, pidMatchList); + ProcessTable* super = &this->super; + ProcessTable_init(super, Class(OpenBSDProcess), host, pidMatchList); return this; } -void ProcessList_delete(Object* cast) { - OpenBSDProcessList* this = (OpenBSDProcessList*) super; - ProcessList_done(&this->super); +void ProcessTable_delete(Object* cast) { + OpenBSDProcessTable* this = (OpenBSDProcessTable*) super; + ProcessTable_done(&this->super); free(this); } -static void OpenBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process* proc) { +static void OpenBSDProcessTable_updateCwd(const struct kinfo_proc* kproc, Process* proc) { const int mib[] = { CTL_KERN, KERN_PROC_CWD, kproc->p_pid }; char buffer[2048]; size_t size = sizeof(buffer); @@ -68,7 +68,7 @@ static void OpenBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process free_and_xStrdup(&proc->procCwd, buffer); } -static void OpenBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) { +static void OpenBSDProcessTable_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) { Process_updateComm(proc, kproc->p_comm); /* @@ -127,7 +127,7 @@ static double getpcpu(const OpenBSDMachine* ohost, const struct kinfo_proc* kp) return 100.0 * (double)kp->p_pctcpu / ohost->fscale; } -static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { +static void OpenBSDProcessTable_scanProcs(OpenBSDProcessTable* this) { Machine* host = this->super.host; OpenBSDMachine* ohost = (OpenBSDMachine*) host; const Settings* settings = host->settings; @@ -142,7 +142,7 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { /* Ignore main threads */ if (kproc->p_tid != -1) { - Process* containingProcess = ProcessList_findProcess(&this->super, kproc->p_pid); + Process* containingProcess = ProcessTable_findProcess(&this->super, kproc->p_pid); if (containingProcess) { if (((OpenBSDProcess*)containingProcess)->addr == kproc->p_addr) continue; @@ -152,7 +152,7 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { } bool preExisting = false; - Process* proc = ProcessList_getProcess(&this->super, (kproc->p_tid == -1) ? kproc->p_pid : kproc->p_tid, &preExisting, OpenBSDProcess_new); + Process* proc = ProcessTable_getProcess(&this->super, (kproc->p_tid == -1) ? kproc->p_pid : kproc->p_tid, &preExisting, OpenBSDProcess_new); OpenBSDProcess* op = (OpenBSDProcess*) proc; if (!preExisting) { @@ -165,12 +165,12 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { proc->isUserlandThread = kproc->p_tid != -1; proc->starttime_ctime = kproc->p_ustart_sec; Process_fillStarttimeBuffer(proc); - ProcessList_add(&this->super, proc); + ProcessTable_add(&this->super, proc); - OpenBSDProcessList_updateProcessName(ohost->kd, kproc, proc); + OpenBSDProcessTable_updateProcessName(ohost->kd, kproc, proc); if (settings->ss->flags & PROCESS_FLAG_CWD) { - OpenBSDProcessList_updateCwd(kproc, proc); + OpenBSDProcessTable_updateCwd(kproc, proc); } proc->tty_nr = kproc->p_tdev; @@ -183,7 +183,7 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { } } else { if (settings->updateProcessNames) { - OpenBSDProcessList_updateProcessName(ohost->kd, kproc, proc); + OpenBSDProcessTable_updateProcessName(ohost->kd, kproc, proc); } } @@ -236,8 +236,8 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) { } } -void ProcessList_goThroughEntries(ProcessList* super) { - OpenBSDProcessList* this = (OpenBSDProcessList*) super; +void ProcessTable_goThroughEntries(ProcessTable* super) { + OpenBSDProcessTable* this = (OpenBSDProcessTable*) super; - OpenBSDProcessList_scanProcs(this); + OpenBSDProcessTable_scanProcs(this); } diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessTable.h index 8a03fecb..f911a10b 100644 --- a/openbsd/OpenBSDProcessList.h +++ b/openbsd/OpenBSDProcessTable.h @@ -1,7 +1,7 @@ -#ifndef HEADER_OpenBSDProcessList -#define HEADER_OpenBSDProcessList +#ifndef HEADER_OpenBSDProcessTable +#define HEADER_OpenBSDProcessTable /* -htop - OpenBSDProcessList.h +htop - OpenBSDProcessTable.h (C) 2014 Hisham H. Muhammad (C) 2015 Michael McConville Released under the GNU GPLv2+, see the COPYING file @@ -11,11 +11,11 @@ in the source distribution for its full text. #include <stdbool.h> #include <sys/types.h> -#include "ProcessList.h" +#include "ProcessTable.h" -typedef struct OpenBSDProcessList_ { - ProcessList super; -} OpenBSDProcessList; +typedef struct OpenBSDProcessTable_ { + ProcessTable super; +} OpenBSDProcessTable; #endif |