summaryrefslogtreecommitdiffstats
path: root/freebsd
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2023-08-31 11:56:43 +1000
committerNathan Scott <nathans@redhat.com>2023-08-31 14:13:16 +1000
commitb74673fe37fd379fc350789e696470556776d815 (patch)
treecbe4f036962c439f9c07a9c96302f5908f6410b0 /freebsd
parent214166a049c2a6ac454dbb37b85b04c039a6a17a (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 'freebsd')
-rw-r--r--freebsd/FreeBSDProcessTable.c (renamed from freebsd/FreeBSDProcessList.c)48
-rw-r--r--freebsd/FreeBSDProcessTable.h (renamed from freebsd/FreeBSDProcessList.h)14
2 files changed, 31 insertions, 31 deletions
diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessTable.c
index b3781ad7..5f3b9682 100644
--- a/freebsd/FreeBSDProcessList.c
+++ b/freebsd/FreeBSDProcessTable.c
@@ -1,5 +1,5 @@
/*
-htop - FreeBSDProcessList.c
+htop - FreeBSDProcessTable.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
@@ -7,7 +7,7 @@ in the source distribution for its full text.
#include "config.h" // IWYU pragma: keep
-#include "freebsd/FreeBSDProcessList.h"
+#include "freebsd/FreeBSDProcessTable.h"
#include <assert.h>
#include <limits.h>
@@ -32,7 +32,7 @@ in the source distribution for its full text.
#include "Macros.h"
#include "Object.h"
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "Scheduling.h"
#include "Settings.h"
#include "XUtils.h"
@@ -41,23 +41,23 @@ in the source distribution for its full text.
#include "freebsd/FreeBSDProcess.h"
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- FreeBSDProcessList* this = xCalloc(1, sizeof(FreeBSDProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ FreeBSDProcessTable* this = xCalloc(1, sizeof(FreeBSDProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(FreeBSDProcess), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(FreeBSDProcess), host, pidMatchList);
return super;
}
-void ProcessList_delete(Object* cast) {
- FreeBSDProcessList* this = (FreeBSDProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ FreeBSDProcessTable* this = (FreeBSDProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
-static void FreeBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process* proc) {
+static void FreeBSDProcessTable_updateExe(const struct kinfo_proc* kproc, Process* proc) {
if (Process_isKernelThread(proc)) {
Process_updateExe(proc, NULL);
return;
@@ -74,7 +74,7 @@ static void FreeBSDProcessList_updateExe(const struct kinfo_proc* kproc, Process
Process_updateExe(proc, buffer);
}
-static void FreeBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process* proc) {
+static void FreeBSDProcessTable_updateCwd(const struct kinfo_proc* kproc, Process* proc) {
#ifdef KERN_PROC_CWD
const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_CWD, kproc->ki_pid };
char buffer[2048];
@@ -98,7 +98,7 @@ static void FreeBSDProcessList_updateCwd(const struct kinfo_proc* kproc, Process
#endif
}
-static void FreeBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) {
+static void FreeBSDProcessTable_updateProcessName(kvm_t* kd, const struct kinfo_proc* kproc, Process* proc) {
Process_updateComm(proc, kproc->ki_comm);
char** argv = kvm_getargv(kd, kproc, 0);
@@ -130,7 +130,7 @@ static void FreeBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_p
free(cmdline);
}
-static char* FreeBSDProcessList_readJailName(const struct kinfo_proc* kproc) {
+static char* FreeBSDProcessTable_readJailName(const struct kinfo_proc* kproc) {
if (kproc->ki_jid == 0)
return xStrdup("-");
@@ -155,7 +155,7 @@ IGNORE_WCASTQUAL_END
return NULL;
}
-void ProcessList_goThroughEntries(ProcessList* super) {
+void ProcessTable_goThroughEntries(ProcessTable* super) {
const Machine* host = super->super.host;
const FreeBSDMachine* fhost = (const FreeBSDMachine*) host;
const Settings* settings = host->settings;
@@ -168,7 +168,7 @@ void ProcessList_goThroughEntries(ProcessList* super) {
for (int i = 0; i < count; i++) {
const struct kinfo_proc* kproc = &kprocs[i];
bool preExisting = false;
- Process* proc = ProcessList_getProcess(super, kproc->ki_pid, &preExisting, FreeBSDProcess_new);
+ Process* proc = ProcessTable_getProcess(super, kproc->ki_pid, &preExisting, FreeBSDProcess_new);
FreeBSDProcess* fp = (FreeBSDProcess*) proc;
if (!preExisting) {
@@ -188,16 +188,16 @@ void ProcessList_goThroughEntries(ProcessList* super) {
}
Process_fillStarttimeBuffer(proc);
proc->user = UsersTable_getRef(host->usersTable, proc->st_uid);
- ProcessList_add(super, proc);
+ ProcessTable_add(super, proc);
- FreeBSDProcessList_updateExe(kproc, proc);
- FreeBSDProcessList_updateProcessName(fhost->kd, kproc, proc);
+ FreeBSDProcessTable_updateExe(kproc, proc);
+ FreeBSDProcessTable_updateProcessName(fhost->kd, kproc, proc);
if (settings->ss->flags & PROCESS_FLAG_CWD) {
- FreeBSDProcessList_updateCwd(kproc, proc);
+ FreeBSDProcessTable_updateCwd(kproc, proc);
}
- fp->jname = FreeBSDProcessList_readJailName(kproc);
+ fp->jname = FreeBSDProcessTable_readJailName(kproc);
proc->tty_nr = kproc->ki_tdev;
const char* name = (kproc->ki_tdev != NODEV) ? devname(kproc->ki_tdev, S_IFCHR) : NULL;
@@ -212,7 +212,7 @@ void ProcessList_goThroughEntries(ProcessList* super) {
// process can enter jail anytime
fp->jid = kproc->ki_jid;
free(fp->jname);
- fp->jname = FreeBSDProcessList_readJailName(kproc);
+ fp->jname = FreeBSDProcessTable_readJailName(kproc);
}
// if there are reapers in the system, process can get reparented anytime
Process_setParent(proc, kproc->ki_ppid);
@@ -222,7 +222,7 @@ void ProcessList_goThroughEntries(ProcessList* super) {
proc->user = UsersTable_getRef(host->usersTable, proc->st_uid);
}
if (settings->updateProcessNames) {
- FreeBSDProcessList_updateProcessName(fhost->kd, kproc, proc);
+ FreeBSDProcessTable_updateProcessName(fhost->kd, kproc, proc);
}
}
diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessTable.h
index 55247eb7..23a6ab22 100644
--- a/freebsd/FreeBSDProcessList.h
+++ b/freebsd/FreeBSDProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_FreeBSDProcessList
-#define HEADER_FreeBSDProcessList
+#ifndef HEADER_FreeBSDProcessTable
+#define HEADER_FreeBSDProcessTable
/*
-htop - FreeBSDProcessList.h
+htop - FreeBSDProcessTable.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
@@ -11,11 +11,11 @@ in the source distribution for its full text.
#include <sys/types.h>
#include "Hashtable.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "UsersTable.h"
-typedef struct FreeBSDProcessList_ {
- ProcessList super;
-} FreeBSDProcessList;
+typedef struct FreeBSDProcessTable_ {
+ ProcessTable super;
+} FreeBSDProcessTable;
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy