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 /dragonflybsd | |
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 'dragonflybsd')
-rw-r--r-- | dragonflybsd/DragonFlyBSDMachine.c | 8 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDMachine.h | 2 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessList.h | 21 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessTable.c (renamed from dragonflybsd/DragonFlyBSDProcessList.c) | 42 | ||||
-rw-r--r-- | dragonflybsd/DragonFlyBSDProcessTable.h | 21 | ||||
-rw-r--r-- | dragonflybsd/Platform.c | 4 |
6 files changed, 49 insertions, 49 deletions
diff --git a/dragonflybsd/DragonFlyBSDMachine.c b/dragonflybsd/DragonFlyBSDMachine.c index 04962d7c..fd5b58b6 100644 --- a/dragonflybsd/DragonFlyBSDMachine.c +++ b/dragonflybsd/DragonFlyBSDMachine.c @@ -223,7 +223,7 @@ static void DragonFlyBSDMachine_scanCPUTime(Machine* super) { } static void DragonFlyBSDMachine_scanMemoryInfo(Machine* super) { - DragonFlyBSDMachine* this = (DragonFlyBSDProcessList*) super; + DragonFlyBSDMachine* this = (DragonFlyBSDProcessTable*) super; // @etosan: // memory counter relationships seem to be these: @@ -235,10 +235,10 @@ static void DragonFlyBSDMachine_scanMemoryInfo(Machine* super) { //disabled for now, as it is always smaller than phycal amount of memory... //...to avoid "where is my memory?" questions - //sysctl(MIB_vm_stats_vm_v_page_count, 4, &(pl->totalMem), &len, NULL, 0); - //pl->totalMem *= pageSizeKb; + //sysctl(MIB_vm_stats_vm_v_page_count, 4, &(this->totalMem), &len, NULL, 0); + //this->totalMem *= pageSizeKb; sysctl(MIB_hw_physmem, 2, &(super->totalMem), &len, NULL, 0); - pl->totalMem /= 1024; + super->totalMem /= 1024; sysctl(MIB_vm_stats_vm_v_active_count, 4, &(this->memActive), &len, NULL, 0); this->memActive *= this->pageSizeKb; diff --git a/dragonflybsd/DragonFlyBSDMachine.h b/dragonflybsd/DragonFlyBSDMachine.h index 276a73d7..0d4d8ef1 100644 --- a/dragonflybsd/DragonFlyBSDMachine.h +++ b/dragonflybsd/DragonFlyBSDMachine.h @@ -19,7 +19,7 @@ in the source distribution for its full text. #include "Hashtable.h" #include "Machine.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "UsersTable.h" diff --git a/dragonflybsd/DragonFlyBSDProcessList.h b/dragonflybsd/DragonFlyBSDProcessList.h deleted file mode 100644 index 3f5cdc3e..00000000 --- a/dragonflybsd/DragonFlyBSDProcessList.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef HEADER_DragonFlyBSDProcessList -#define HEADER_DragonFlyBSDProcessList -/* -htop - DragonFlyBSDProcessList.h -(C) 2014 Hisham H. Muhammad -(C) 2017 Diederik de Groot -Released under the GNU GPLv2+, see the COPYING file -in the source distribution for its full text. -*/ - -#include <stdbool.h> -#include <sys/param.h> - -#include "ProcessList.h" - - -typedef struct DragonFlyBSDProcessList_ { - ProcessList super; -} DragonFlyBSDProcessList; - -#endif diff --git a/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessTable.c index 6330e911..07c852e5 100644 --- a/dragonflybsd/DragonFlyBSDProcessList.c +++ b/dragonflybsd/DragonFlyBSDProcessTable.c @@ -1,12 +1,12 @@ /* -htop - DragonFlyBSDProcessList.c +htop - DragonFlyBSDProcessTable.c (C) 2014 Hisham H. Muhammad (C) 2017 Diederik de Groot Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ -#include "dragonflybsd/DragonFlyBSDProcessList.h" +#include "dragonflybsd/DragonFlyBSDProcessTable.h" #include <fcntl.h> #include <limits.h> @@ -26,23 +26,23 @@ in the source distribution for its full text. #include "dragonflybsd/DragonFlyBSDProcess.h" -ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) { - DragonFlyBSDProcessList* this = xCalloc(1, sizeof(DragonFlyBSDProcessList)); - Object_setClass(this, Class(ProcessList)); +ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) { + DragonFlyBSDProcessTable* this = xCalloc(1, sizeof(DragonFlyBSDProcessTable)); + Object_setClass(this, Class(ProcessTable)); - ProcessList* super = (ProcessList*) this; - ProcessList_init(super, Class(DragonFlyBSDProcess), host, pidMatchList); + ProcessTable* super = (ProcessTable*) this; + ProcessTable_init(super, Class(DragonFlyBSDProcess), host, pidMatchList); return super; } -void ProcessList_delete(Object* cast) { - const DragonFlyBSDProcessList* this = (DragonFlyBSDProcessList*) cast; - ProcessList_done(&this->super); +void ProcessTable_delete(Object* cast) { + const DragonFlyBSDProcessTable* this = (DragonFlyBSDProcessTable*) cast; + ProcessTable_done(&this->super); free(this); } -//static void DragonFlyBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process* proc) { +//static void DragonFlyBSDProcessTable_updateExe(const struct kinfo_proc* kproc, Process* proc) { // const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, kproc->kp_pid }; // char buffer[2048]; // size_t size = sizeof(buffer); @@ -60,7 +60,7 @@ void ProcessList_delete(Object* cast) { // Process_updateExe(proc, buffer); //} -static void DragonFlyBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process* proc) { +static void DragonFlyBSDProcessTable_updateExe(const struct kinfo_proc* kproc, Process* proc) { if (Process_isKernelThread(proc)) return; @@ -76,7 +76,7 @@ static void DragonFlyBSDProcessList_updateExe(const struct kinfo_proc* kproc, Pr Process_updateExe(proc, target); } -static void DragonFlyBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process* proc) { +static void DragonFlyBSDProcessTable_updateCwd(const struct kinfo_proc* kproc, Process* proc) { const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_CWD, kproc->kp_pid }; char buffer[2048]; size_t size = sizeof(buffer); @@ -96,7 +96,7 @@ static void DragonFlyBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Pr free_and_xStrdup(&proc->procCwd, buffer); } -static void DragonFlyBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) { +static void DragonFlyBSDProcessTable_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) { Process_updateComm(proc, kproc->kp_comm); char** argv = kvm_getargv(kd, kproc, 0); @@ -129,7 +129,7 @@ static void DragonFlyBSDProcessList_updateProcessName(kvm_t* kd, const struct ki free(cmdline); } -void ProcessList_goThroughEntries(ProcessList* super) { +void ProcessTable_goThroughEntries(ProcessTable* super) { const Machine* host = super->host; const DragonFlyMachine* dhost = (const DragonFlyMachine*) host; const Settings* settings = host->settings; @@ -147,7 +147,7 @@ void ProcessList_goThroughEntries(ProcessList* super) { 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(super, kproc->kp_ktaddr ? (pid_t)kproc->kp_ktaddr : kproc->kp_pid, &preExisting, DragonFlyBSDProcess_new); + Process* proc = ProcessTable_getProcess(super, kproc->kp_ktaddr ? (pid_t)kproc->kp_ktaddr : kproc->kp_pid, &preExisting, DragonFlyBSDProcess_new); DragonFlyBSDProcess* dfp = (DragonFlyBSDProcess*) proc; if (!preExisting) { @@ -182,14 +182,14 @@ void ProcessList_goThroughEntries(ProcessList* super) { free_and_xStrdup(&proc->tty_name, name); } - DragonFlyBSDProcessList_updateExe(kproc, proc); - DragonFlyBSDProcessList_updateProcessName(dhost->kd, kproc, proc); + DragonFlyBSDProcessTable_updateExe(kproc, proc); + DragonFlyBSDProcessTable_updateProcessName(dhost->kd, kproc, proc); if (settings->ss->flags & PROCESS_FLAG_CWD) { - DragonFlyBSDProcessList_updateCwd(kproc, proc); + DragonFlyBSDProcessTable_updateCwd(kproc, proc); } - ProcessList_add(super, proc); + ProcessTable_add(super, proc); dfp->jname = DragonFlyBSDMachine_readJailName(dhost, kproc->kp_jailid); } else { @@ -206,7 +206,7 @@ void ProcessList_goThroughEntries(ProcessList* super) { proc->user = UsersTable_getRef(host->usersTable, proc->st_uid); } if (settings->updateProcessNames) { - DragonFlyBSDProcessList_updateProcessName(dhost->kd, kproc, proc); + DragonFlyBSDProcessTable_updateProcessName(dhost->kd, kproc, proc); } } diff --git a/dragonflybsd/DragonFlyBSDProcessTable.h b/dragonflybsd/DragonFlyBSDProcessTable.h new file mode 100644 index 00000000..e8ff1af4 --- /dev/null +++ b/dragonflybsd/DragonFlyBSDProcessTable.h @@ -0,0 +1,21 @@ +#ifndef HEADER_DragonFlyBSDProcessTable +#define HEADER_DragonFlyBSDProcessTable +/* +htop - DragonFlyBSDProcessTable.h +(C) 2014 Hisham H. Muhammad +(C) 2017 Diederik de Groot +Released under the GNU GPLv2+, see the COPYING file +in the source distribution for its full text. +*/ + +#include <stdbool.h> +#include <sys/param.h> + +#include "ProcessTable.h" + + +typedef struct DragonFlyBSDProcessTable_ { + ProcessTable super; +} DragonFlyBSDProcessTable; + +#endif diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 51d89467..95f0bec6 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -26,14 +26,14 @@ in the source distribution for its full text. #include "Macros.h" #include "MemoryMeter.h" #include "MemorySwapMeter.h" -#include "ProcessList.h" +#include "ProcessTable.h" #include "SwapMeter.h" #include "SysArchMeter.h" #include "TasksMeter.h" #include "UptimeMeter.h" #include "XUtils.h" #include "dragonflybsd/DragonFlyBSDProcess.h" -#include "dragonflybsd/DragonFlyBSDProcessList.h" +#include "dragonflybsd/DragonFlyBSDProcessTable.h" #include "generic/fdstat_sysctl.h" |