summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--Action.c2
-rw-r--r--CPUMeter.c2
-rw-r--r--ChangeLog2
-rw-r--r--ClockMeter.c2
-rw-r--r--CommandLine.c8
-rw-r--r--DateMeter.c2
-rw-r--r--DateTimeMeter.c2
-rw-r--r--DiskIOMeter.c2
-rw-r--r--DynamicColumn.h2
-rw-r--r--DynamicMeter.c2
-rw-r--r--LoadAverageMeter.c2
-rw-r--r--Makefile.am40
-rw-r--r--NetworkIOMeter.c2
-rw-r--r--Process.c8
-rw-r--r--ProcessList.h59
-rw-r--r--ProcessTable.c (renamed from ProcessList.c)34
-rw-r--r--ProcessTable.h59
-rw-r--r--ScreenManager.c2
-rw-r--r--TESTPLAN2
-rw-r--r--Table.c2
-rw-r--r--TasksMeter.c16
-rw-r--r--darwin/DarwinProcess.c12
-rw-r--r--darwin/DarwinProcess.h4
-rw-r--r--darwin/DarwinProcessTable.c (renamed from darwin/DarwinProcessList.c)42
-rw-r--r--darwin/DarwinProcessTable.h (renamed from darwin/DarwinProcessList.h)14
-rw-r--r--dragonflybsd/DragonFlyBSDMachine.c8
-rw-r--r--dragonflybsd/DragonFlyBSDMachine.h2
-rw-r--r--dragonflybsd/DragonFlyBSDProcessList.h21
-rw-r--r--dragonflybsd/DragonFlyBSDProcessTable.c (renamed from dragonflybsd/DragonFlyBSDProcessList.c)42
-rw-r--r--dragonflybsd/DragonFlyBSDProcessTable.h21
-rw-r--r--dragonflybsd/Platform.c4
-rw-r--r--freebsd/FreeBSDProcessTable.c (renamed from freebsd/FreeBSDProcessList.c)48
-rw-r--r--freebsd/FreeBSDProcessTable.h (renamed from freebsd/FreeBSDProcessList.h)14
-rw-r--r--linux/HugePageMeter.c2
-rw-r--r--linux/LinuxMachine.c4
-rw-r--r--linux/LinuxProcessTable.c (renamed from linux/LinuxProcessList.c)148
-rw-r--r--linux/LinuxProcessTable.h (renamed from linux/LinuxProcessList.h)14
-rw-r--r--linux/ZramStats.h2
-rw-r--r--linux/ZswapStats.h2
-rw-r--r--netbsd/NetBSDMachine.c8
-rw-r--r--netbsd/NetBSDMachine.h2
-rw-r--r--netbsd/NetBSDProcessTable.c (renamed from netbsd/NetBSDProcessList.c)48
-rw-r--r--netbsd/NetBSDProcessTable.h (renamed from netbsd/NetBSDProcessList.h)14
-rw-r--r--openbsd/OpenBSDMachine.c2
-rw-r--r--openbsd/OpenBSDProcessTable.c (renamed from openbsd/OpenBSDProcessList.c)46
-rw-r--r--openbsd/OpenBSDProcessTable.h (renamed from openbsd/OpenBSDProcessList.h)14
-rw-r--r--pcp/PCPDynamicColumn.c2
-rw-r--r--pcp/PCPMachine.c2
-rw-r--r--pcp/PCPProcessTable.c (renamed from pcp/PCPProcessList.c)120
-rw-r--r--pcp/PCPProcessTable.h (renamed from pcp/PCPProcessList.h)14
-rw-r--r--pcp/Platform.c4
-rw-r--r--solaris/SolarisProcess.c2
-rw-r--r--solaris/SolarisProcessTable.c (renamed from solaris/SolarisProcessList.c)66
-rw-r--r--solaris/SolarisProcessTable.h (renamed from solaris/SolarisProcessList.h)14
-rw-r--r--unsupported/UnsupportedProcessList.h17
-rw-r--r--unsupported/UnsupportedProcessTable.c (renamed from unsupported/UnsupportedProcessList.c)28
-rw-r--r--unsupported/UnsupportedProcessTable.h17
57 files changed, 538 insertions, 538 deletions
diff --git a/Action.c b/Action.c
index e00383c7..e7b69ee0 100644
--- a/Action.c
+++ b/Action.c
@@ -27,7 +27,7 @@ in the source distribution for its full text.
#include "MainPanel.h"
#include "OpenFilesScreen.h"
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "ProcessLocksScreen.h"
#include "ProvideCurses.h"
#include "Scheduling.h"
diff --git a/CPUMeter.c b/CPUMeter.c
index c12bb72c..782f4170 100644
--- a/CPUMeter.c
+++ b/CPUMeter.c
@@ -16,7 +16,7 @@ in the source distribution for its full text.
#include "Macros.h"
#include "Object.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "Settings.h"
#include "XUtils.h"
diff --git a/ChangeLog b/ChangeLog
index 5717a52e..706dab67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -53,7 +53,7 @@ What's new in version 3.2.1
* On Solaris, fix the build
* On NetBSD, OpenBSD and Solaris ensure env buffer size is sufficient
* On Linux, resolve processes exiting interfering with sampling
-* Fix ProcessList quadratic removal when scanning processes
+* Fix ProcessTable quadratic removal when scanning processes
* Under LXC, limit CPU count to that given by /proc/cpuinfo
* Improve container detection for LXC
* Some minor documentation fixes
diff --git a/ClockMeter.c b/ClockMeter.c
index ee712ae2..82c3968b 100644
--- a/ClockMeter.c
+++ b/ClockMeter.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Object.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
static const int ClockMeter_attributes[] = {
diff --git a/CommandLine.c b/CommandLine.c
index 2cd90516..effaca48 100644
--- a/CommandLine.c
+++ b/CommandLine.c
@@ -34,7 +34,7 @@ in the source distribution for its full text.
#include "Panel.h"
#include "Platform.h"
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "ProvideCurses.h"
#include "ScreenManager.h"
#include "Settings.h"
@@ -341,9 +341,9 @@ int CommandLine_run(int argc, char** argv) {
Hashtable* ds = DynamicScreens_new();
Machine* host = Machine_new(ut, flags.userId);
- ProcessList* pl = ProcessList_new(host, flags.pidMatchList);
+ ProcessTable* pt = ProcessTable_new(host, flags.pidMatchList);
Settings* settings = Settings_new(host->activeCPUs, dm, dc, ds);
- Machine_populateTablesFromSettings(host, settings, &pl->super);
+ Machine_populateTablesFromSettings(host, settings, &pt->super);
Header* header = Header_new(host, 2);
Header_populateFromSettings(header);
@@ -402,7 +402,7 @@ int CommandLine_run(int argc, char** argv) {
Machine_scanTables(host);
if (settings->ss->allBranchesCollapsed)
- Table_collapseAllBranches(&pl->super);
+ Table_collapseAllBranches(&pt->super);
ScreenManager_run(scr, NULL, NULL, NULL);
diff --git a/DateMeter.c b/DateMeter.c
index b38f43b0..224de306 100644
--- a/DateMeter.c
+++ b/DateMeter.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Object.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
static const int DateMeter_attributes[] = {
diff --git a/DateTimeMeter.c b/DateTimeMeter.c
index d46f3cb2..ebe72288 100644
--- a/DateTimeMeter.c
+++ b/DateTimeMeter.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Object.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
static const int DateTimeMeter_attributes[] = {
diff --git a/DiskIOMeter.c b/DiskIOMeter.c
index 545ec008..4227dfa9 100644
--- a/DiskIOMeter.c
+++ b/DiskIOMeter.c
@@ -15,7 +15,7 @@ in the source distribution for its full text.
#include "Meter.h"
#include "Object.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "XUtils.h"
diff --git a/DynamicColumn.h b/DynamicColumn.h
index 3b0336a9..bdce82d2 100644
--- a/DynamicColumn.h
+++ b/DynamicColumn.h
@@ -25,7 +25,7 @@ typedef struct DynamicColumn_ {
char* description; /* displayed in setup menu (detail) */
int width; /* display width +/- for value alignment */
bool enabled; /* false == ignore this column (until enabled) */
- Table* table; /* pointer to DynamicScreen or ProcessList */
+ Table* table; /* pointer to DynamicScreen or ProcessTable */
} DynamicColumn;
Hashtable* DynamicColumns_new(void);
diff --git a/DynamicMeter.c b/DynamicMeter.c
index 82e73a92..96b169d5 100644
--- a/DynamicMeter.c
+++ b/DynamicMeter.c
@@ -17,7 +17,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Object.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "XUtils.h"
diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c
index 0beae04b..be6215db 100644
--- a/LoadAverageMeter.c
+++ b/LoadAverageMeter.c
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Object.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "XUtils.h"
diff --git a/Makefile.am b/Makefile.am
index 90bd30ef..080411f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,8 +73,8 @@ myhtopsources = \
OptionItem.c \
Panel.c \
Process.c \
- ProcessList.c \
ProcessLocksScreen.c \
+ ProcessTable.c \
Row.c \
RichString.c \
Scheduling.c \
@@ -141,8 +141,8 @@ myhtopheaders = \
OptionItem.h \
Panel.h \
Process.h \
- ProcessList.h \
ProcessLocksScreen.h \
+ ProcessTable.h \
ProvideCurses.h \
ProvideTerm.h \
RichString.h \
@@ -178,7 +178,7 @@ linux_platform_headers = \
linux/LibSensors.h \
linux/LinuxMachine.h \
linux/LinuxProcess.h \
- linux/LinuxProcessList.h \
+ linux/LinuxProcessTable.h \
linux/Platform.h \
linux/PressureStallMeter.h \
linux/ProcessField.h \
@@ -201,7 +201,7 @@ linux_platform_sources = \
linux/LibSensors.c \
linux/LinuxMachine.c \
linux/LinuxProcess.c \
- linux/LinuxProcessList.c \
+ linux/LinuxProcessTable.c \
linux/Platform.c \
linux/PressureStallMeter.c \
linux/SELinuxMeter.c \
@@ -221,7 +221,7 @@ endif
freebsd_platform_headers = \
freebsd/FreeBSDMachine.h \
- freebsd/FreeBSDProcessList.h \
+ freebsd/FreeBSDProcessTable.h \
freebsd/FreeBSDProcess.h \
freebsd/Platform.h \
freebsd/ProcessField.h \
@@ -237,7 +237,7 @@ freebsd_platform_headers = \
freebsd_platform_sources = \
freebsd/Platform.c \
freebsd/FreeBSDMachine.c \
- freebsd/FreeBSDProcessList.c \
+ freebsd/FreeBSDProcessTable.c \
freebsd/FreeBSDProcess.c \
generic/fdstat_sysctl.c \
generic/gettime.c \
@@ -257,7 +257,7 @@ endif
dragonflybsd_platform_headers = \
dragonflybsd/DragonFlyBSDMachine.h \
- dragonflybsd/DragonFlyBSDProcessList.h \
+ dragonflybsd/DragonFlyBSDProcessTable.h \
dragonflybsd/DragonFlyBSDProcess.h \
dragonflybsd/Platform.h \
dragonflybsd/ProcessField.h \
@@ -268,7 +268,7 @@ dragonflybsd_platform_headers = \
dragonflybsd_platform_sources = \
dragonflybsd/DragonFlyBSDMachine.c \
- dragonflybsd/DragonFlyBSDProcessList.c \
+ dragonflybsd/DragonFlyBSDProcessTable.c \
dragonflybsd/DragonFlyBSDProcess.c \
dragonflybsd/Platform.c \
generic/fdstat_sysctl.c \
@@ -293,7 +293,7 @@ netbsd_platform_headers = \
netbsd/ProcessField.h \
netbsd/NetBSDMachine.h \
netbsd/NetBSDProcess.h \
- netbsd/NetBSDProcessList.h
+ netbsd/NetBSDProcessTable.h
netbsd_platform_sources = \
generic/fdstat_sysctl.c \
@@ -303,7 +303,7 @@ netbsd_platform_sources = \
netbsd/Platform.c \
netbsd/NetBSDMachine.c \
netbsd/NetBSDProcess.c \
- netbsd/NetBSDProcessList.c
+ netbsd/NetBSDProcessTable.c
if HTOP_NETBSD
myhtopplatheaders = $(netbsd_platform_headers)
@@ -318,7 +318,7 @@ openbsd_platform_headers = \
generic/hostname.h \
generic/uname.h \
openbsd/OpenBSDMachine.h \
- openbsd/OpenBSDProcessList.h \
+ openbsd/OpenBSDProcessTable.h \
openbsd/OpenBSDProcess.h \
openbsd/Platform.h \
openbsd/ProcessField.h
@@ -328,7 +328,7 @@ openbsd_platform_sources = \
generic/hostname.c \
generic/uname.c \
openbsd/OpenBSDMachine.c \
- openbsd/OpenBSDProcessList.c \
+ openbsd/OpenBSDProcessTable.c \
openbsd/OpenBSDProcess.c \
openbsd/Platform.c
@@ -343,7 +343,7 @@ endif
darwin_platform_headers = \
darwin/DarwinMachine.h \
darwin/DarwinProcess.h \
- darwin/DarwinProcessList.h \
+ darwin/DarwinProcessTable.h \
darwin/Platform.h \
darwin/PlatformHelpers.h \
darwin/ProcessField.h \
@@ -361,7 +361,7 @@ darwin_platform_sources = \
darwin/PlatformHelpers.c \
darwin/DarwinMachine.c \
darwin/DarwinProcess.c \
- darwin/DarwinProcessList.c \
+ darwin/DarwinProcessTable.c \
generic/fdstat_sysctl.c \
generic/gettime.c \
generic/hostname.c \
@@ -387,7 +387,7 @@ solaris_platform_headers = \
solaris/Platform.h \
solaris/SolarisMachine.h \
solaris/SolarisProcess.h \
- solaris/SolarisProcessList.h \
+ solaris/SolarisProcessTable.h \
zfs/ZfsArcMeter.h \
zfs/ZfsArcStats.h \
zfs/ZfsCompressedArcMeter.h
@@ -399,7 +399,7 @@ solaris_platform_sources = \
solaris/Platform.c \
solaris/SolarisMachine.c \
solaris/SolarisProcess.c \
- solaris/SolarisProcessList.c \
+ solaris/SolarisProcessTable.c \
zfs/ZfsArcMeter.c \
zfs/ZfsCompressedArcMeter.c
@@ -426,7 +426,7 @@ pcp_platform_headers = \
pcp/PCPDynamicScreen.h \
pcp/PCPMachine.h \
pcp/PCPProcess.h \
- pcp/PCPProcessList.h \
+ pcp/PCPProcessTable.h \
zfs/ZfsArcMeter.h \
zfs/ZfsArcStats.h \
zfs/ZfsCompressedArcMeter.h
@@ -444,7 +444,7 @@ pcp_platform_sources = \
pcp/PCPDynamicScreen.c \
pcp/PCPMachine.c \
pcp/PCPProcess.c \
- pcp/PCPProcessList.c \
+ pcp/PCPProcessTable.c \
zfs/ZfsArcMeter.c \
zfs/ZfsCompressedArcMeter.c
@@ -463,14 +463,14 @@ unsupported_platform_headers = \
unsupported/ProcessField.h \
unsupported/UnsupportedMachine.h \
unsupported/UnsupportedProcess.h \
- unsupported/UnsupportedProcessList.h
+ unsupported/UnsupportedProcessTable.h
unsupported_platform_sources = \
generic/gettime.c \
unsupported/Platform.c \
unsupported/UnsupportedMachine.c \
unsupported/UnsupportedProcess.c \
- unsupported/UnsupportedProcessList.c
+ unsupported/UnsupportedProcessTable.c
if HTOP_UNSUPPORTED
myhtopplatsources = $(unsupported_platform_sources)
diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c
index 5945bae7..90991590 100644
--- a/NetworkIOMeter.c
+++ b/NetworkIOMeter.c
@@ -9,7 +9,7 @@
#include "Object.h"
#include "Platform.h"
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "XUtils.h"
diff --git a/Process.c b/Process.c
index 6c4fb7ad..805e9242 100644
--- a/Process.c
+++ b/Process.c
@@ -25,7 +25,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Macros.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "DynamicColumn.h"
#include "RichString.h"
#include "Scheduling.h"
@@ -826,9 +826,9 @@ static bool Process_matchesFilter(const Process* this, const Table* table) {
if (incFilter && !String_contains_i(Process_getCommand(this), incFilter, true))
return true;
- const ProcessList* pl = (const ProcessList*) host->activeTable;
- assert(Object_isA((const Object*) pl, (const ObjectClass*) &ProcessList_class));
- if (pl->pidMatchList && !Hashtable_get(pl->pidMatchList, Process_getThreadGroup(this)))
+ const ProcessTable* pt = (const ProcessTable*) host->activeTable;
+ assert(Object_isA((const Object*) pt, (const ObjectClass*) &ProcessTable_class));
+ if (pt->pidMatchList && !Hashtable_get(pt->pidMatchList, Process_getThreadGroup(this)))
return true;
return false;
diff --git a/ProcessList.h b/ProcessList.h
deleted file mode 100644
index 9710a0a5..00000000
--- a/ProcessList.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef HEADER_ProcessList
-#define HEADER_ProcessList
-/*
-htop - ProcessList.h
-(C) 2004,2005 Hisham H. Muhammad
-Released under the GNU GPLv2+, see the COPYING file
-in the source distribution for its full text.
-*/
-
-#include "config.h" // IWYU pragma: keep
-
-#include <limits.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include "Hashtable.h"
-#include "Machine.h"
-#include "Object.h"
-#include "Panel.h"
-#include "Process.h"
-#include "RichString.h"
-#include "Table.h"
-
-
-typedef struct ProcessList_ {
- Table super;
-
- Hashtable* pidMatchList;
-
- unsigned int totalTasks;
- unsigned int runningTasks;
- unsigned int userlandThreads;
- unsigned int kernelThreads;
-} ProcessList;
-
-/* Implemented by platforms */
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList);
-void ProcessList_delete(Object* cast);
-void ProcessList_goThroughEntries(ProcessList* this);
-
-void ProcessList_init(ProcessList* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList);
-
-void ProcessList_done(ProcessList* this);
-
-extern const TableClass ProcessList_class;
-
-static inline void ProcessList_add(ProcessList* this, Process* process) {
- Table_add(&this->super, &process->super);
-}
-
-Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor);
-
-static inline Process* ProcessList_findProcess(ProcessList* this, pid_t pid) {
- return (Process*) Table_findRow(&this->super, pid);
-}
-
-#endif
diff --git a/ProcessList.c b/ProcessTable.c
index 516dcd7c..39e3eb87 100644
--- a/ProcessList.c
+++ b/ProcessTable.c
@@ -1,11 +1,11 @@
/*
-htop - ProcessList.c
+htop - ProcessTable.c
(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include <assert.h>
#include <stdlib.h>
@@ -20,17 +20,17 @@ in the source distribution for its full text.
#include "XUtils.h"
-void ProcessList_init(ProcessList* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList) {
+void ProcessTable_init(ProcessTable* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList) {
Table_init(&this->super, klass, host);
this->pidMatchList = pidMatchList;
}
-void ProcessList_done(ProcessList* this) {
+void ProcessTable_done(ProcessTable* this) {
Table_done(&this->super);
}
-Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting, Process_New constructor) {
+Process* ProcessTable_getProcess(ProcessTable* this, pid_t pid, bool* preExisting, Process_New constructor) {
const Table* table = &this->super;
Process* proc = (Process*) Hashtable_get(table->table, pid);
*preExisting = proc != NULL;
@@ -45,8 +45,8 @@ Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting,
return proc;
}
-static void ProcessList_prepareEntries(Table* super) {
- ProcessList* this = (ProcessList*) super;
+static void ProcessTable_prepareEntries(Table* super) {
+ ProcessTable* this = (ProcessTable*) super;
this->totalTasks = 0;
this->userlandThreads = 0;
this->kernelThreads = 0;
@@ -55,13 +55,13 @@ static void ProcessList_prepareEntries(Table* super) {
Table_prepareEntries(super);
}
-static void ProcessList_iterateEntries(Table* super) {
- ProcessList* this = (ProcessList*) super;
+static void ProcessTable_iterateEntries(Table* super) {
+ ProcessTable* this = (ProcessTable*) super;
// calling into platform-specific code
- ProcessList_goThroughEntries(this);
+ ProcessTable_goThroughEntries(this);
}
-static void ProcessList_cleanupEntries(Table* super) {
+static void ProcessTable_cleanupEntries(Table* super) {
Machine* host = super->host;
const Settings* settings = host->settings;
@@ -69,7 +69,7 @@ static void ProcessList_cleanupEntries(Table* super) {
for (int i = Vector_size(super->rows) - 1; i >= 0; i--) {
Process* p = (Process*) Vector_get(super->rows, i);
- // tidy up Process state after refreshing the ProcessList table
+ // tidy up Process state after refreshing the ProcessTable table
Process_makeCommandStr(p, settings);
// keep track of the highest UID for column scaling
@@ -83,12 +83,12 @@ static void ProcessList_cleanupEntries(Table* super) {
Table_compact(super);
}
-const TableClass ProcessList_class = {
+const TableClass ProcessTable_class = {
.super = {
.extends = Class(Table),
- .delete = ProcessList_delete,
+ .delete = ProcessTable_delete,
},
- .prepare = ProcessList_prepareEntries,
- .iterate = ProcessList_iterateEntries,
- .cleanup = ProcessList_cleanupEntries,
+ .prepare = ProcessTable_prepareEntries,
+ .iterate = ProcessTable_iterateEntries,
+ .cleanup = ProcessTable_cleanupEntries,
};
diff --git a/ProcessTable.h b/ProcessTable.h
new file mode 100644
index 00000000..ceaabc79
--- /dev/null
+++ b/ProcessTable.h
@@ -0,0 +1,59 @@
+#ifndef HEADER_ProcessTable
+#define HEADER_ProcessTable
+/*
+htop - ProcessTable.h
+(C) 2004,2005 Hisham H. Muhammad
+Released under the GNU GPLv2+, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "config.h" // IWYU pragma: keep
+
+#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <sys/time.h>
+#include <sys/types.h>
+
+#include "Hashtable.h"
+#include "Machine.h"
+#include "Object.h"
+#include "Panel.h"
+#include "Process.h"
+#include "RichString.h"
+#include "Table.h"
+
+
+typedef struct ProcessTable_ {
+ Table super;
+
+ Hashtable* pidMatchList;
+
+ unsigned int totalTasks;
+ unsigned int runningTasks;
+ unsigned int userlandThreads;
+ unsigned int kernelThreads;
+} ProcessTable;
+
+/* Implemented by platforms */
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList);
+void ProcessTable_delete(Object* cast);
+void ProcessTable_goThroughEntries(ProcessTable* this);
+
+void ProcessTable_init(ProcessTable* this, const ObjectClass* klass, Machine* host, Hashtable* pidMatchList);
+
+void ProcessTable_done(ProcessTable* this);
+
+extern const TableClass ProcessTable_class;
+
+static inline void ProcessTable_add(ProcessTable* this, Process* process) {
+ Table_add(&this->super, &process->super);
+}
+
+Process* ProcessTable_getProcess(ProcessTable* this, pid_t pid, bool* preExisting, Process_New constructor);
+
+static inline Process* ProcessTable_findProcess(ProcessTable* this, pid_t pid) {
+ return (Process*) Table_findRow(&this->super, pid);
+}
+
+#endif
diff --git a/ScreenManager.c b/ScreenManager.c
index 6c1dd12e..f4d59a42 100644
--- a/ScreenManager.c
+++ b/ScreenManager.c
@@ -20,7 +20,7 @@ in the source distribution for its full text.
#include "Macros.h"
#include "Object.h"
#include "Platform.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "ProvideCurses.h"
#include "XUtils.h"
diff --git a/TESTPLAN b/TESTPLAN
index 88fe039d..b6ddfa6a 100644
--- a/TESTPLAN
+++ b/TESTPLAN
@@ -5,7 +5,7 @@ Main screen:
Mouse click header - nothing happens.
- Mouse click on ProcessList title bar - exit Tree view, update FunctionBar, title bar updates, sort by clicked field.
+ Mouse click on ProcessTable title bar - exit Tree view, update FunctionBar, title bar updates, sort by clicked field.
*** FAILING: wrong FB update depending on mode; does not change sort in wip branch
click on same entry - invert sort.
click on another entry - sort another field.
diff --git a/Table.c b/Table.c
index aecc7e6d..a5b91ab4 100644
--- a/Table.c
+++ b/Table.c
@@ -66,7 +66,7 @@ void Table_add(Table* this, Row* row) {
// Table_removeIndex removes a given row from the lists map and soft deletes
// it from its vector. Vector_compact *must* be called once the caller is done
// removing items.
-// Note: for processes should only be called from ProcessList_iterate to avoid
+// Note: for processes should only be called from ProcessTable_iterate to avoid
// breaking dying process highlighting.
void Table_removeIndex(Table* this, const Row* row, int idx) {
int rowid = row->id;
diff --git a/TasksMeter.c b/TasksMeter.c
index 7dd6fdb4..6ea965b8 100644
--- a/TasksMeter.c
+++ b/TasksMeter.c
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Macros.h"
#include "Object.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "Settings.h"
#include "XUtils.h"
@@ -25,15 +25,15 @@ static const int TasksMeter_attributes[] = {
static void TasksMeter_updateValues(Meter* this) {
const Machine* host = this->host;
- const ProcessList* pl = (const ProcessList*) host->processTable;
+ const ProcessTable* pt = (const ProcessTable*) host->processTable;
- this->values[0] = pl->kernelThreads;
- this->values[1] = pl->userlandThreads;
- this->values[2] = pl->totalTasks - pl->kernelThreads - pl->userlandThreads;
- this->values[3] = MINIMUM(pl->runningTasks, host->activeCPUs);
- this->total = pl->totalTasks;
+ this->values[0] = pt->kernelThreads;
+ this->values[1] = pt->userlandThreads;
+ this->values[2] = pt->totalTasks - pt->kernelThreads - pt->userlandThreads;
+ this->values[3] = MINIMUM(pt->runningTasks, host->activeCPUs);
+ this->total = pt->totalTasks;
- xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%u/%u", MINIMUM(pl->runningTasks, host->activeCPUs), pl->totalTasks);
+ xSnprintf(this->txtBuffer, sizeof(this->txtBuffer), "%u/%u", MINIMUM(pt->runningTasks, host->activeCPUs), pt->totalTasks);
}
static void TasksMeter_display(const Object* cast, RichString* out) {
diff --git a/darwin/DarwinProcess.c b/darwin/DarwinProcess.c
index ec98341e..4f58832d 100644
--- a/darwin/DarwinProcess.c
+++ b/darwin/DarwinProcess.c
@@ -299,7 +299,7 @@ void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps,
/* UNSET HERE :
*
* processor
- * user (set at ProcessList level)
+ * user (set at ProcessTable level)
* nlwp
* percent_cpu
* percent_mem
@@ -362,7 +362,7 @@ void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps,
proc->super.updated = true;
}
-void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList* dpl, double timeIntervalNS) {
+void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessTable* dpt, double timeIntervalNS) {
struct proc_taskinfo pti;
if (sizeof(pti) == proc_pidinfo(Process_getPid(&proc->super), PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
@@ -394,10 +394,10 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList*
proc->stime = system_time_ns;
proc->utime = user_time_ns;
- dpl->super.kernelThreads += 0; /*pti.pti_threads_system;*/
- dpl->super.userlandThreads += pti.pti_threadnum; /*pti.pti_threads_user;*/
- dpl->super.totalTasks += pti.pti_threadnum;
- dpl->super.runningTasks += pti.pti_numrunning;
+ dpt->super.kernelThreads += 0; /*pti.pti_threads_system;*/
+ dpt->super.userlandThreads += pti.pti_threadnum; /*pti.pti_threads_user;*/
+ dpt->super.totalTasks += pti.pti_threadnum;
+ dpt->super.runningTasks += pti.pti_numrunning;
}
}
diff --git a/darwin/DarwinProcess.h b/darwin/DarwinProcess.h
index 89a0576d..496b179b 100644
--- a/darwin/DarwinProcess.h
+++ b/darwin/DarwinProcess.h
@@ -10,7 +10,7 @@ in the source distribution for its full text.
#include <sys/sysctl.h>
#include "Machine.h"
-#include "darwin/DarwinProcessList.h"
+#include "darwin/DarwinProcessTable.h"
#define PROCESS_FLAG_TTY 0x00000100
@@ -34,7 +34,7 @@ void Process_delete(Object* cast);
void DarwinProcess_setFromKInfoProc(Process* proc, const struct kinfo_proc* ps, bool exists);
-void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList* dpl, double timeIntervalNS);
+void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessTable* dpt, double timeIntervalNS);
/*
* Scan threads for process state information.
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessTable.c
index 1545600e..850b503f 100644
--- a/darwin/DarwinProcessList.c
+++ b/darwin/DarwinProcessTable.c
@@ -1,11 +1,11 @@
/*
-htop - DarwinProcessList.c
+htop - DarwinProcessTable.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "darwin/DarwinProcessList.h"
+#include "darwin/DarwinProcessTable.h"
#include <errno.h>
#include <libproc.h>
@@ -19,7 +19,7 @@ in the source distribution for its full text.
#include <sys/sysctl.h>
#include "CRT.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "darwin/DarwinMachine.h"
#include "darwin/DarwinProcess.h"
#include "darwin/Platform.h"
@@ -28,7 +28,7 @@ in the source distribution for its full text.
#include "zfs/ZfsArcStats.h"
-static struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
+static struct kinfo_proc* ProcessTable_getKInfoProcs(size_t* count) {
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
struct kinfo_proc* processes = NULL;
@@ -53,40 +53,40 @@ static struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
CRT_fatalError("Unable to get kinfo_procs");
}
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- DarwinProcessList* this = xCalloc(1, sizeof(DarwinProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ DarwinProcessTable* this = xCalloc(1, sizeof(DarwinProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(DarwinProcess), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(DarwinProcess), host, pidMatchList);
return super;
}
-void ProcessList_delete(Object* cast) {
- DarwinProcessList* this = (DarwinProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ DarwinProcessTable* this = (DarwinProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
-void ProcessList_goThroughEntries(ProcessList* super) {
+void ProcessTable_goThroughEntries(ProcessTable* super) {
const Machine* host = super->super.host;
const DarwinMachine* dhost = (const DarwinMachine*) host;
- DarwinProcessList* dpl = (DarwinProcessList*) super;
+ DarwinProcessTable* dpt = (DarwinProcessTable*) super;
bool preExisting = true;
struct kinfo_proc* ps;
size_t count;
DarwinProcess* proc;
/* Get the time difference */
- dpl->global_diff = 0;
+ dpt->global_diff = 0;
for (unsigned int i = 0; i < host->existingCPUs; ++i) {
for (size_t j = 0; j < CPU_STATE_MAX; ++j) {
- dpl->global_diff += dhost->curr_load[i].cpu_ticks[j] - dhost->prev_load[i].cpu_ticks[j];
+ dpt->global_diff += dhost->curr_load[i].cpu_ticks[j] - dhost->prev_load[i].cpu_ticks[j];
}
}
- const double time_interval_ns = Platform_schedulerTicksToNanoseconds(dpl->global_diff) / (double) host->activeCPUs;
+ const double time_interval_ns = Platform_schedulerTicksToNanoseconds(dpt->global_diff) / (double) host->activeCPUs;
/* We use kinfo_procs for initial data since :
*
@@ -95,13 +95,13 @@ void ProcessList_goThroughEntries(ProcessList* super) {
*
* We attempt to fill-in additional information with libproc.
*/
- ps = ProcessList_getKInfoProcs(&count);
+ ps = ProcessTable_getKInfoProcs(&count);
for (size_t i = 0; i < count; ++i) {
- proc = (DarwinProcess*)ProcessList_getProcess(super, ps[i].kp_proc.p_pid, &preExisting, DarwinProcess_new);
+ proc = (DarwinProcess*)ProcessTable_getProcess(super, ps[i].kp_proc.p_pid, &preExisting, DarwinProcess_new);
DarwinProcess_setFromKInfoProc(&proc->super, &ps[i], preExisting);
- DarwinProcess_setFromLibprocPidinfo(proc, dpl, time_interval_ns);
+ DarwinProcess_setFromLibprocPidinfo(proc, dpt, time_interval_ns);
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;
@@ -118,7 +118,7 @@ void ProcessList_goThroughEntries(ProcessList* super) {
super->totalTasks += 1;
if (!preExisting) {
- ProcessList_add(super, &proc->super);
+ ProcessTable_add(super, &proc->super);
}
}
diff --git a/darwin/DarwinProcessList.h b/darwin/DarwinProcessTable.h
index 56d6c1b5..7467bfd9 100644
--- a/darwin/DarwinProcessList.h
+++ b/darwin/DarwinProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_DarwinProcessList
-#define HEADER_DarwinProcessList
+#ifndef HEADER_DarwinProcessTable
+#define HEADER_DarwinProcessTable
/*
-htop - DarwinProcessList.h
+htop - DarwinProcessTable.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
@@ -10,13 +10,13 @@ in the source distribution for its full text.
#include <mach/mach_host.h>
#include <sys/sysctl.h>
-#include "ProcessList.h"
+#include "ProcessTable.h"
-typedef struct DarwinProcessList_ {
- ProcessList super;
+typedef struct DarwinProcessTable_ {
+ ProcessTable super;
uint64_t global_diff;
-} DarwinProcessList;
+} DarwinProcessTable;
#endif
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"
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
diff --git a/linux/HugePageMeter.c b/linux/HugePageMeter.c
index 62f8e7eb..65e3f2d7 100644
--- a/linux/HugePageMeter.c
+++ b/linux/HugePageMeter.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
#include "CRT.h"
#include "Macros.h"
#include "Object.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "linux/LinuxMachine.h"
diff --git a/linux/LinuxMachine.c b/linux/LinuxMachine.c
index ff2087c7..34cd5d0b 100644
--- a/linux/LinuxMachine.c
+++ b/linux/LinuxMachine.c
@@ -505,8 +505,8 @@ static void LinuxMachine_scanCPUTime(LinuxMachine* this) {
char buffer[PROC_LINE_LENGTH + 1];
while (fgets(buffer, sizeof(buffer), file)) {
if (String_startsWith(buffer, "procs_running")) {
- ProcessList* pl = (ProcessList*) super->processTable;
- pl->runningTasks = strtoul(buffer + strlen("procs_running"), NULL, 10);
+ ProcessTable* pt = (ProcessTable*) super->processTable;
+ pt->runningTasks = strtoul(buffer + strlen("procs_running"), NULL, 10);
break;
}
}
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessTable.c
index 9be2433e..962274c9 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessTable.c
@@ -1,5 +1,5 @@
/*
-htop - LinuxProcessList.c
+htop - LinuxProcessTable.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 "linux/LinuxProcessList.h"
+#include "linux/LinuxProcessTable.h"
#include <assert.h>
#include <ctype.h>
@@ -131,7 +131,7 @@ static int sortTtyDrivers(const void* va, const void* vb) {
return SPACESHIP_NUMBER(a->minorFrom, b->minorFrom);
}
-static void LinuxProcessList_initTtyDrivers(LinuxProcessList* this) {
+static void LinuxProcessTable_initTtyDrivers(LinuxProcessTable* this) {
TtyDriver* ttyDrivers;
char buf[16384];
@@ -187,7 +187,7 @@ static void LinuxProcessList_initTtyDrivers(LinuxProcessList* this) {
#ifdef HAVE_DELAYACCT
-static void LinuxProcessList_initNetlinkSocket(LinuxProcessList* this) {
+static void LinuxProcessTable_initNetlinkSocket(LinuxProcessTable* this) {
this->netlink_socket = nl_socket_alloc();
if (this->netlink_socket == NULL) {
return;
@@ -200,14 +200,14 @@ static void LinuxProcessList_initNetlinkSocket(LinuxProcessList* this) {
#endif
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- LinuxProcessList* this = xCalloc(1, sizeof(LinuxProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ LinuxProcessTable* this = xCalloc(1, sizeof(LinuxProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(LinuxProcess), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(LinuxProcess), host, pidMatchList);
- LinuxProcessList_initTtyDrivers(this);
+ LinuxProcessTable_initTtyDrivers(this);
// Test /proc/PID/smaps_rollup availability (faster to parse, Linux 4.14+)
this->haveSmapsRollup = (access(PROCDIR "/self/smaps_rollup", R_OK) == 0);
@@ -215,9 +215,9 @@ ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
return super;
}
-void ProcessList_delete(Object* cast) {
- LinuxProcessList* this = (LinuxProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ LinuxProcessTable* this = (LinuxProcessTable*) cast;
+ ProcessTable_done(&this->super);
if (this->ttyDrivers) {
for (int i = 0; this->ttyDrivers[i].path; i++) {
free(this->ttyDrivers[i].path);
@@ -233,12 +233,12 @@ void ProcessList_delete(Object* cast) {
free(this);
}
-static inline unsigned long long LinuxProcessList_adjustTime(const LinuxMachine* lhost, unsigned long long t) {
+static inline unsigned long long LinuxProcessTable_adjustTime(const LinuxMachine* lhost, unsigned long long t) {
return t * 100 / lhost->jiffies;
}
/* Taken from: https://github.com/torvalds/linux/blob/64570fbc14f8d7cb3fe3995f20e26bc25ce4b2cc/fs/proc/array.c#L120 */
-static inline ProcessState LinuxProcessList_getProcessState(char state) {
+static inline ProcessState LinuxProcessTable_getProcessState(char state) {
switch (state) {
case 'S': return SLEEPING;
case 'X': return DEFUNCT;
@@ -253,7 +253,7 @@ static inline ProcessState LinuxProcessList_getProcessState(char state) {
}
}
-static bool LinuxProcessList_readStatFile(LinuxProcess* lp, openat_arg_t procFd, const LinuxMachine* lhost, bool scanMainThread, char* command, size_t commLen) {
+static bool LinuxProcessTable_readStatFile(LinuxProcess* lp, openat_arg_t procFd, const LinuxMachine* lhost, bool scanMainThread, char* command, size_t commLen) {
Process* process = &lp->super;
char buf[MAX_READ + 1];
@@ -282,7 +282,7 @@ static bool LinuxProcessList_readStatFile(LinuxProcess* lp, openat_arg_t procFd,
location = end + 2;
/* (3) state - %c */
- process->state = LinuxProcessList_getProcessState(location[0]);
+ process->state = LinuxProcessTable_getProcessState(location[0]);
location += 2;
/* (4) ppid - %d */
@@ -326,19 +326,19 @@ static bool LinuxProcessList_readStatFile(LinuxProcess* lp, openat_arg_t procFd,
location += 1;
/* (14) utime - %lu */
- lp->utime = LinuxProcessList_adjustTime(lhost, strtoull(location, &location, 10));
+ lp->utime = LinuxProcessTable_adjustTime(lhost, strtoull(location, &location, 10));
location += 1;
/* (15) stime - %lu */
- lp->stime = LinuxProcessList_adjustTime(lhost, strtoull(location, &location, 10));
+ lp->stime = LinuxProcessTable_adjustTime(lhost, strtoull(location, &location, 10));
location += 1;
/* (16) cutime - %ld */
- lp->cutime = LinuxProcessList_adjustTime(lhost, strtoull(location, &location, 10));
+ lp->cutime = LinuxProcessTable_adjustTime(lhost, strtoull(location, &location, 10));
location += 1;
/* (17) cstime - %ld */
- lp->cstime = LinuxProcessList_adjustTime(lhost, strtoull(location, &location, 10));
+ lp->cstime = LinuxProcessTable_adjustTime(lhost, strtoull(location, &location, 10));
location += 1;
/* (18) priority - %ld */
@@ -358,7 +358,7 @@ static bool LinuxProcessList_readStatFile(LinuxProcess* lp, openat_arg_t procFd,
/* (22) starttime - %llu */
if (process->starttime_ctime == 0) {
- process->starttime_ctime = lhost->boottime + LinuxProcessList_adjustTime(lhost, strtoll(location, &location, 10)) / 100;
+ process->starttime_ctime = lhost->boottime + LinuxProcessTable_adjustTime(lhost, strtoll(location, &location, 10)) / 100;
} else {
location = strchr(location, ' ');
}
@@ -381,7 +381,7 @@ static bool LinuxProcessList_readStatFile(LinuxProcess* lp, openat_arg_t procFd,
return true;
}
-static bool LinuxProcessList_readStatusFile(Process* process, openat_arg_t procFd) {
+static bool LinuxProcessTable_readStatusFile(Process* process, openat_arg_t procFd) {
LinuxProcess* lp = (LinuxProcess*) process;
unsigned long ctxt = 0;
@@ -464,7 +464,7 @@ static bool LinuxProcessList_readStatusFile(Process* process, openat_arg_t procF
return true;
}
-static bool LinuxProcessList_updateUser(const Machine* host, Process* process, openat_arg_t procFd) {
+static bool LinuxProcessTable_updateUser(const Machine* host, Process* process, openat_arg_t procFd) {
struct stat sstat;
#ifdef HAVE_OPENAT
int statok = fstat(procFd, &sstat);
@@ -482,7 +482,7 @@ static bool LinuxProcessList_updateUser(const Machine* host, Process* process, o
return true;
}
-static void LinuxProcessList_readIoFile(LinuxProcess* lp, openat_arg_t procFd, bool scanMainThread) {
+static void LinuxProcessTable_readIoFile(LinuxProcess* lp, openat_arg_t procFd, bool scanMainThread) {
Process* process = &lp->super;
const Machine* host = process->super.host;
char path[20] = "io";
@@ -554,7 +554,7 @@ typedef struct LibraryData_ {
bool exec;
} LibraryData;
-static void LinuxProcessList_calcLibSize_helper(ATTR_UNUSED ht_key_t key, void* value, void* data) {
+static void LinuxProcessTable_calcLibSize_helper(ATTR_UNUSED ht_key_t key, void* value, void* data) {
if (!data)
return;
@@ -569,7 +569,7 @@ static void LinuxProcessList_calcLibSize_helper(ATTR_UNUSED ht_key_t key, void*
*d += v->size;
}
-static void LinuxProcessList_readMaps(LinuxProcess* process, openat_arg_t procFd, const LinuxMachine* host, bool calcSize, bool checkDeletedLib) {
+static void LinuxProcessTable_readMaps(LinuxProcess* process, openat_arg_t procFd, const LinuxMachine* host, bool calcSize, bool checkDeletedLib) {
Process* proc = (Process*)process;
proc->usesDeletedLib = false;
@@ -670,7 +670,7 @@ static void LinuxProcessList_readMaps(LinuxProcess* process, openat_arg_t procFd
if (calcSize) {
uint64_t total_size = 0;
- Hashtable_foreach(ht, LinuxProcessList_calcLibSize_helper, &total_size);
+ Hashtable_foreach(ht, LinuxProcessTable_calcLibSize_helper, &total_size);
Hashtable_delete(ht);
@@ -678,7 +678,7 @@ static void LinuxProcessList_readMaps(LinuxProcess* process, openat_arg_t procFd
}
}
-static bool LinuxProcessList_readStatmFile(LinuxProcess* process, openat_arg_t procFd, const LinuxMachine* host) {
+static bool LinuxProcessTable_readStatmFile(LinuxProcess* process, openat_arg_t procFd, const LinuxMachine* host) {
FILE* statmfile = fopenat(procFd, "statm", "r");
if (!statmfile)
return false;
@@ -703,7 +703,7 @@ static bool LinuxProcessList_readStatmFile(LinuxProcess* process, openat_arg_t p
return r == 7;
}
-static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, openat_arg_t procFd, bool haveSmapsRollup) {
+static bool LinuxProcessTable_readSmapsFile(LinuxProcess* process, openat_arg_t procFd, bool haveSmapsRollup) {
//http://elixir.free-electrons.com/linux/v4.10/source/fs/proc/task_mmu.c#L719
//kernel will return data in chunks of size PAGE_SIZE or less.
FILE* f = fopenat(procFd, haveSmapsRollup ? "smaps_rollup" : "smaps", "r");
@@ -741,7 +741,7 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, openat_arg_t p
#ifdef HAVE_OPENVZ
-static void LinuxProcessList_readOpenVZData(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readOpenVZData(LinuxProcess* process, openat_arg_t procFd) {
if (access(PROCDIR "/vz", R_OK) != 0) {
free(process->ctid);
process->ctid = NULL;
@@ -831,7 +831,7 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, openat_arg_t
#endif
-static void LinuxProcessList_readCGroupFile(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readCGroupFile(LinuxProcess* process, openat_arg_t procFd) {
FILE* file = fopenat(procFd, "cgroup", "r");
if (!file) {
if (process->cgroup) {
@@ -903,7 +903,7 @@ static void LinuxProcessList_readCGroupFile(LinuxProcess* process, openat_arg_t
}
}
-static void LinuxProcessList_readOomData(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readOomData(LinuxProcess* process, openat_arg_t procFd) {
FILE* file = fopenat(procFd, "oom_score", "r");
if (!file)
return;
@@ -919,7 +919,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, openat_arg_t pro
fclose(file);
}
-static void LinuxProcessList_readAutogroup(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readAutogroup(LinuxProcess* process, openat_arg_t procFd) {
process->autogroup_id = -1;
char autogroup[64]; // space for two numeric values and fixed length strings
@@ -936,7 +936,7 @@ static void LinuxProcessList_readAutogroup(LinuxProcess* process, openat_arg_t p
}
}
-static void LinuxProcessList_readSecattrData(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readSecattrData(LinuxProcess* process, openat_arg_t procFd) {
FILE* file = fopenat(procFd, "attr/current", "r");
if (!file) {
free(process->secattr);
@@ -965,7 +965,7 @@ static void LinuxProcessList_readSecattrData(LinuxProcess* process, openat_arg_t
free_and_xStrdup(&process->secattr, buffer);
}
-static void LinuxProcessList_readCwd(LinuxProcess* process, openat_arg_t procFd) {
+static void LinuxProcessTable_readCwd(LinuxProcess* process, openat_arg_t procFd) {
char pathBuffer[PATH_MAX + 1] = {0};
#if defined(HAVE_READLINKAT) && defined(HAVE_OPENAT)
@@ -1025,11 +1025,11 @@ static int handleNetlinkMsg(struct nl_msg* nlmsg, void* linuxProcess) {
return NL_OK;
}
-static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProcess* process) {
+static void LinuxProcessTable_readDelayAcctData(LinuxProcessTable* this, LinuxProcess* process) {
struct nl_msg* msg;
if (!this->netlink_socket) {
- LinuxProcessList_initNetlinkSocket(this);
+ LinuxProcessTable_initNetlinkSocket(this);
if (!this->netlink_socket) {
goto delayacct_failure;
}
@@ -1069,7 +1069,7 @@ delayacct_failure:
#endif
-static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t procFd) {
+static bool LinuxProcessTable_readCmdlineFile(Process* process, openat_arg_t procFd) {
char command[4096 + 1]; // max cmdline length on Linux
ssize_t amtRead = xReadfileat(procFd, "cmdline", command, sizeof(command));
if (amtRead <= 0)
@@ -1242,7 +1242,7 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc
return true;
}
-static char* LinuxProcessList_updateTtyDevice(TtyDriver* ttyDrivers, unsigned long int tty_nr) {
+static char* LinuxProcessTable_updateTtyDevice(TtyDriver* ttyDrivers, unsigned long int tty_nr) {
unsigned int maj = major(tty_nr);
unsigned int min = minor(tty_nr);
@@ -1312,15 +1312,15 @@ static bool isOlderThan(const Process* proc, unsigned int seconds) {
return realtime - proc->starttime_ctime > seconds;
}
-static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_t parentFd, const LinuxMachine* lhost, const char* dirname, const Process* parent) {
- ProcessList* pl = (ProcessList*) this;
+static bool LinuxProcessTable_recurseProcTree(LinuxProcessTable* this, openat_arg_t parentFd, const LinuxMachine* lhost, const char* dirname, const Process* parent) {
+ ProcessTable* pt = (ProcessTable*) this;
const Machine* host = &lhost->super;
const Settings* settings = host->settings;
const ScreenSettings* ss = settings->ss;
const struct dirent* entry;
/* set runningTasks from /proc/stat (from Machine_scanCPUTime) */
- pl->runningTasks = lhost->runningTasks;
+ pt->runningTasks = lhost->runningTasks;
#ifdef HAVE_OPENAT
int dirFd = openat(parentFd, dirname, O_RDONLY | O_DIRECTORY | O_NOFOLLOW);
@@ -1383,33 +1383,33 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
#endif
bool preExisting;
- Process* proc = ProcessList_getProcess(pl, pid, &preExisting, LinuxProcess_new);
+ Process* proc = ProcessTable_getProcess(pt, pid, &preExisting, LinuxProcess_new);
LinuxProcess* lp = (LinuxProcess*) proc;
Process_setThreadGroup(proc, parent ? Process_getPid(parent) : pid);
proc->isUserlandThread = Process_getPid(proc) != Process_getThreadGroup(proc);
- LinuxProcessList_recurseProcTree(this, procFd, lhost, "task", proc);
+ LinuxProcessTable_recurseProcTree(this, procFd, lhost, "task", proc);
/*
* These conditions will not trigger on first occurrence, cause we need to
- * add the process to the ProcessList and do all one time scans
+ * add the process to the ProcessTable and do all one time scans
* (e.g. parsing the cmdline to detect a kernel thread)
* But it will short-circuit subsequent scans.
*/
if (preExisting && hideKernelThreads && Process_isKernelThread(proc)) {
proc->super.updated = true;
proc->super.show = false;
- pl->kernelThreads++;
- pl->totalTasks++;
+ pt->kernelThreads++;
+ pt->totalTasks++;
Compat_openatArgClose(procFd);
continue;
}
if (preExisting && hideUserlandThreads && Process_isUserlandThread(proc)) {
proc->super.updated = true;
proc->super.show = false;
- pl->userlandThreads++;
- pl->totalTasks++;
+ pt->userlandThreads++;
+ pt->totalTasks++;
Compat_openatArgClose(procFd);
continue;
}
@@ -1422,9 +1422,9 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
bool scanMainThread = !hideUserlandThreads && !Process_isKernelThread(proc) && !parent;
if (ss->flags & PROCESS_FLAG_IO)
- LinuxProcessList_readIoFile(lp, procFd, scanMainThread);
+ LinuxProcessTable_readIoFile(lp, procFd, scanMainThread);
- if (!LinuxProcessList_readStatmFile(lp, procFd, lhost))
+ if (!LinuxProcessTable_readStatmFile(lp, procFd, lhost))
goto errorReadingProcess;
{
@@ -1440,7 +1440,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
if (passedTimeInMs > recheck) {
lp->last_mlrs_calctime = host->realtimeMs;
- LinuxProcessList_readMaps(lp, procFd, lhost, ss->flags & PROCESS_FLAG_LINUX_LRS_FIX, settings->highlightDeletedExe);
+ LinuxProcessTable_readMaps(lp, procFd, lhost, ss->flags & PROCESS_FLAG_LINUX_LRS_FIX, settings->highlightDeletedExe);
}
} else {
/* Copy from process structure in threads and reset if setting got disabled */
@@ -1457,7 +1457,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
// Read smaps file of each process only every second pass to improve performance
static int smaps_flag = 0;
if ((pid & 1) == smaps_flag) {
- LinuxProcessList_readSmapsFile(lp, procFd, this->haveSmapsRollup);
+ LinuxProcessTable_readSmapsFile(lp, procFd, this->haveSmapsRollup);
}
if (pid == 1) {
smaps_flag = !smaps_flag;
@@ -1470,7 +1470,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
char statCommand[MAX_NAME + 1];
unsigned long long int lasttimes = (lp->utime + lp->stime);
unsigned long int tty_nr = proc->tty_nr;
- if (!LinuxProcessList_readStatFile(lp, procFd, lhost, scanMainThread, statCommand, sizeof(statCommand)))
+ if (!LinuxProcessTable_readStatFile(lp, procFd, lhost, scanMainThread, statCommand, sizeof(statCommand)))
goto errorReadingProcess;
if (lp->flags & PF_KTHREAD) {
@@ -1479,7 +1479,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
if (tty_nr != proc->tty_nr && this->ttyDrivers) {
free(proc->tty_name);
- proc->tty_name = LinuxProcessList_updateTtyDevice(this->ttyDrivers, proc->tty_nr);
+ proc->tty_name = LinuxProcessTable_updateTtyDevice(this->ttyDrivers, proc->tty_nr);
}
if (ss->flags & PROCESS_FLAG_LINUX_IOPRIO) {
@@ -1495,62 +1495,62 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
proc->percent_mem = proc->m_resident / (double)(host->totalMem) * 100.0;
Process_updateCPUFieldWidths(proc->percent_cpu);
- if (! LinuxProcessList_updateUser(host, proc, procFd))
+ if (! LinuxProcessTable_updateUser(host, proc, procFd))
goto errorReadingProcess;
- if (!LinuxProcessList_readStatusFile(proc, procFd))
+ if (!LinuxProcessTable_readStatusFile(proc, procFd))
goto errorReadingProcess;
if (!preExisting) {
#ifdef HAVE_OPENVZ
if (ss->flags & PROCESS_FLAG_LINUX_OPENVZ) {
- LinuxProcessList_readOpenVZData(lp, procFd);
+ LinuxProcessTable_readOpenVZData(lp, procFd);
}
#endif
if (proc->isKernelThread) {
Process_updateCmdline(proc, NULL, 0, 0);
- } else if (!LinuxProcessList_readCmdlineFile(proc, procFd)) {
+ } else if (!LinuxProcessTable_readCmdlineFile(proc, procFd)) {
Process_updateCmdline(proc, statCommand, 0, strlen(statCommand));
}
Process_fillStarttimeBuffer(proc);
- ProcessList_add(pl, proc);
+ ProcessTable_add(pt, proc);
} else {
if (settings->updateProcessNames && proc->state != ZOMBIE) {
if (proc->isKernelThread) {
Process_updateCmdline(proc, NULL, 0, 0);
- } else if (!LinuxProcessList_readCmdlineFile(proc, procFd)) {
+ } else if (!LinuxProcessTable_readCmdlineFile(proc, procFd)) {
Process_updateCmdline(proc, statCommand, 0, strlen(statCommand));
}
}
}
if (ss->flags & PROCESS_FLAG_LINUX_CGROUP)
- LinuxProcessList_readCGroupFile(lp, procFd);
+ LinuxProcessTable_readCGroupFile(lp, procFd);
#ifdef HAVE_DELAYACCT
if (ss->flags & PROCESS_FLAG_LINUX_DELAYACCT) {
- LinuxProcessList_readDelayAcctData(this, lp);
+ LinuxProcessTable_readDelayAcctData(this, lp);
}
#endif
if (ss->flags & PROCESS_FLAG_LINUX_OOM) {
- LinuxProcessList_readOomData(lp, procFd);
+ LinuxProcessTable_readOomData(lp, procFd);
}
if (ss->flags & PROCESS_FLAG_LINUX_SECATTR) {
- LinuxProcessList_readSecattrData(lp, procFd);
+ LinuxProcessTable_readSecattrData(lp, procFd);
}
if (ss->flags & PROCESS_FLAG_CWD) {
- LinuxProcessList_readCwd(lp, procFd);
+ LinuxProcessTable_readCwd(lp, procFd);
}
if ((ss->flags & PROCESS_FLAG_LINUX_AUTOGROUP) && this->haveAutogroup) {
- LinuxProcessList_readAutogroup(lp, procFd);
+ LinuxProcessTable_readAutogroup(lp, procFd);
}
#ifdef SCHEDULER_SUPPORT
@@ -1577,15 +1577,15 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
}
if (Process_isKernelThread(proc)) {
- pl->kernelThreads++;
+ pt->kernelThreads++;
} else if (Process_isUserlandThread(proc)) {
- pl->userlandThreads++;
+ pt->userlandThreads++;
}
/* Set at the end when we know if a new entry is a thread */
proc->super.show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
- pl->totalTasks++;
+ pt->totalTasks++;
/* runningTasks is set in Machine_scanCPUTime() from /proc/stat */
continue;
@@ -1614,8 +1614,8 @@ errorReadingProcess:
return true;
}
-void ProcessList_goThroughEntries(ProcessList* super) {
- LinuxProcessList* this = (LinuxProcessList*) super;
+void ProcessTable_goThroughEntries(ProcessTable* super) {
+ LinuxProcessTable* this = (LinuxProcessTable*) super;
const Machine* host = super->super.host;
const Settings* settings = host->settings;
const LinuxMachine* lhost = (const LinuxMachine*) host;
@@ -1638,5 +1638,5 @@ void ProcessList_goThroughEntries(ProcessList* super) {
openat_arg_t rootFd = "";
#endif
- LinuxProcessList_recurseProcTree(this, rootFd, lhost, PROCDIR, NULL);
+ LinuxProcessTable_recurseProcTree(this, rootFd, lhost, PROCDIR, NULL);
}
diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessTable.h
index 824de482..f97afd38 100644
--- a/linux/LinuxProcessList.h
+++ b/linux/LinuxProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_LinuxProcessList
-#define HEADER_LinuxProcessList
+#ifndef HEADER_LinuxProcessTable
+#define HEADER_LinuxProcessTable
/*
-htop - LinuxProcessList.h
+htop - LinuxProcessTable.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
@@ -13,7 +13,7 @@ in the source distribution for its full text.
#include <sys/types.h>
#include "Hashtable.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "UsersTable.h"
@@ -24,8 +24,8 @@ typedef struct TtyDriver_ {
unsigned int minorTo;
} TtyDriver;
-typedef struct LinuxProcessList_ {
- ProcessList super;
+typedef struct LinuxProcessTable_ {
+ ProcessTable super;
TtyDriver* ttyDrivers;
bool haveSmapsRollup;
@@ -35,6 +35,6 @@ typedef struct LinuxProcessList_ {
struct nl_sock* netlink_socket;
int netlink_family;
#endif
-} LinuxProcessList;
+} LinuxProcessTable;
#endif
diff --git a/linux/ZramStats.h b/linux/ZramStats.h
index 1c1625a4..f71a6c27 100644
--- a/linux/ZramStats.h
+++ b/linux/ZramStats.h
@@ -7,7 +7,7 @@ Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "ProcessList.h"
+#include "ProcessTable.h"
typedef struct ZramStats_ {
memory_t totalZram;
diff --git a/linux/ZswapStats.h b/linux/ZswapStats.h
index 78771e10..080f1e2a 100644
--- a/linux/ZswapStats.h
+++ b/linux/ZswapStats.h
@@ -7,7 +7,7 @@ Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "ProcessList.h"
+#include "ProcessTable.h"
typedef struct ZswapStats_ {
/* maximum size of the zswap pool */
diff --git a/netbsd/NetBSDMachine.c b/netbsd/NetBSDMachine.c
index c1e6f7ed..245b8231 100644
--- a/netbsd/NetBSDMachine.c
+++ b/netbsd/NetBSDMachine.c
@@ -129,7 +129,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) {
}
void Machine_delete(Machine* super) {
- NetBSDMachine* this = (NetBSDProcessList*) super;
+ NetBSDMachine* this = (NetBSDMachine*) super;
Machine_done(super);
@@ -266,11 +266,11 @@ static void NetBSDMachine_scanCPUFrequency(NetBSDMachine* this) {
void Machine_scan(Machine* super) {
NetBSDMachine* this = (NetBSDMachine*) super;
- NetBSDProcessList_scanMemoryInfo(this);
- NetBSDProcessList_scanCPUTime(this);
+ NetBSDProcessTable_scanMemoryInfo(this);
+ NetBSDProcessTable_scanCPUTime(this);
if (super->settings->showCPUFrequency) {
- NetBSDProcessList_scanCPUFrequency(npl);
+ NetBSDProcessTable_scanCPUFrequency(npl);
}
}
diff --git a/netbsd/NetBSDMachine.h b/netbsd/NetBSDMachine.h
index 9c4e75ed..9d3aa0b2 100644
--- a/netbsd/NetBSDMachine.h
+++ b/netbsd/NetBSDMachine.h
@@ -15,7 +15,7 @@ in the source distribution for its full text.
#include <sys/types.h>
#include "Machine.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
typedef struct CPUData_ {
diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessTable.c
index 1327de70..885a2edd 100644
--- a/netbsd/NetBSDProcessList.c
+++ b/netbsd/NetBSDProcessTable.c
@@ -1,5 +1,5 @@
/*
-htop - NetBSDProcessList.c
+htop - NetBSDProcessTable.c
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
(C) 2021 Santhosh Raju
@@ -8,7 +8,7 @@ Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "netbsd/NetBSDProcessList.h"
+#include "netbsd/NetBSDProcessTable.h"
#include <kvm.h>
#include <math.h>
@@ -28,30 +28,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 "netbsd/NetBSDMachine.h"
#include "netbsd/NetBSDProcess.h"
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- NetBSDProcessList* this = xCalloc(1, sizeof(NetBSDProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ NetBSDProcessTable* this = xCalloc(1, sizeof(NetBSDProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = (ProcessList*) this;
- ProcessList_init(super, Class(NetBSDProcess), host, pidMatchList);
+ ProcessTable* super = (ProcessTable*) this;
+ ProcessTable_init(super, Class(NetBSDProcess), host, pidMatchList);
return super;
}
-void ProcessList_delete(Object* cast) {
- NetBSDProcessList* this = (NetBSDProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ NetBSDProcessTable* this = (NetBSDProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
-static void NetBSDProcessList_updateExe(const struct kinfo_proc2* kproc, Process* proc) {
+static void NetBSDProcessTable_updateExe(const struct kinfo_proc2* kproc, Process* proc) {
const int mib[] = { CTL_KERN, KERN_PROC_ARGS, kproc->p_pid, KERN_PROC_PATHNAME };
char buffer[2048];
size_t size = sizeof(buffer);
@@ -69,7 +69,7 @@ static void NetBSDProcessList_updateExe(const struct kinfo_proc2* kproc, Process
Process_updateExe(proc, buffer);
}
-static void NetBSDProcessList_updateCwd(const struct kinfo_proc2* kproc, Process* proc) {
+static void NetBSDProcessTable_updateCwd(const struct kinfo_proc2* kproc, Process* proc) {
const int mib[] = { CTL_KERN, KERN_PROC_ARGS, kproc->p_pid, KERN_PROC_CWD };
char buffer[2048];
size_t size = sizeof(buffer);
@@ -89,7 +89,7 @@ static void NetBSDProcessList_updateCwd(const struct kinfo_proc2* kproc, Process
free_and_xStrdup(&proc->procCwd, buffer);
}
-static void NetBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_proc2* kproc, Process* proc) {
+static void NetBSDProcessTable_updateProcessName(kvm_t* kd, const struct kinfo_proc2* kproc, Process* proc) {
Process_updateComm(proc, kproc->p_comm);
/*
@@ -148,7 +148,7 @@ static double getpcpu(const NetBSDMachine* nhost, const struct kinfo_proc2* kp)
return 100.0 * (double)kp->p_pctcpu / nhost->fscale;
}
-static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
+static void NetBSDProcessTable_scanProcs(NetBSDProcessTable* this) {
const Machine* host = this->super.host;
const NetBSDMachine* nhost = (const NetBSDMachine*) host;
const Settings* settings = host->settings;
@@ -162,7 +162,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
const struct kinfo_proc2* kproc = &kprocs[i];
bool preExisting = false;
- Process* proc = ProcessList_getProcess(&this->super, kproc->p_pid, &preExisting, NetBSDProcess_new);
+ Process* proc = ProcessTable_getProcess(&this->super, kproc->p_pid, &preExisting, NetBSDProcess_new);
proc->super.show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
@@ -177,7 +177,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
proc->isUserlandThread = Process_getPid(proc) != Process_getThreadGroup(proc); // eh?
proc->starttime_ctime = kproc->p_ustart_sec;
Process_fillStarttimeBuffer(proc);
- ProcessList_add(&this->super, proc);
+ ProcessTable_add(&this->super, proc);
proc->tty_nr = kproc->p_tdev;
const char* name = ((dev_t)kproc->p_tdev != KERN_PROC_TTY_NODEV) ? devname(kproc->p_tdev, S_IFCHR) : NULL;
@@ -188,16 +188,16 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
free_and_xStrdup(&proc->tty_name, name);
}
- NetBSDProcessList_updateExe(kproc, proc);
- NetBSDProcessList_updateProcessName(nhost->kd, kproc, proc);
+ NetBSDProcessTable_updateExe(kproc, proc);
+ NetBSDProcessTable_updateProcessName(nhost->kd, kproc, proc);
} else {
if (settings->updateProcessNames) {
- NetBSDProcessList_updateProcessName(nhost->kd, kproc, proc);
+ NetBSDProcessTable_updateProcessName(nhost->kd, kproc, proc);
}
}
if (settings->ss->flags & PROCESS_FLAG_CWD) {
- NetBSDProcessList_updateCwd(kproc, proc);
+ NetBSDProcessTable_updateCwd(kproc, proc);
}
if (proc->st_uid != kproc->p_uid) {
@@ -266,8 +266,8 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) {
}
}
-void ProcessList_goThroughEntries(ProcessList* super) {
- NetBSDProcessList* npl = (NetBSDProcessList*) super;
+void ProcessTable_goThroughEntries(ProcessTable* super) {
+ NetBSDProcessTable* npt = (NetBSDProcessTable*) super;
- NetBSDProcessList_scanProcs(npl);
+ NetBSDProcessTable_scanProcs(npt);
}
diff --git a/netbsd/NetBSDProcessList.h b/netbsd/NetBSDProcessTable.h
index 362d84fc..1bcfa985 100644
--- a/netbsd/NetBSDProcessList.h
+++ b/netbsd/NetBSDProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_NetBSDProcessList
-#define HEADER_NetBSDProcessList
+#ifndef HEADER_NetBSDProcessTable
+#define HEADER_NetBSDProcessTable
/*
-htop - NetBSDProcessList.h
+htop - NetBSDProcessTable.h
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
(C) 2021 Santhosh Raju
@@ -14,11 +14,11 @@ in the source distribution for its full text.
#include <sys/types.h>
#include "Hashtable.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
-typedef struct NetBSDProcessList_ {
- ProcessList super;
-} NetBSDProcessList;
+typedef struct NetBSDProcessTable_ {
+ ProcessTable super;
+} NetBSDProcessTable;
#endif
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
diff --git a/pcp/PCPDynamicColumn.c b/pcp/PCPDynamicColumn.c
index 02d3ab9c..534a9ba6 100644
--- a/pcp/PCPDynamicColumn.c
+++ b/pcp/PCPDynamicColumn.c
@@ -23,7 +23,7 @@ in the source distribution for its full text.
#include "Macros.h"
#include "Platform.h"
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "RichString.h"
#include "XUtils.h"
diff --git a/pcp/PCPMachine.c b/pcp/PCPMachine.c
index 801f3978..16403247 100644
--- a/pcp/PCPMachine.c
+++ b/pcp/PCPMachine.c
@@ -1,5 +1,5 @@
/*
-htop - PCPProcessList.c
+htop - PCPProcessTable.c
(C) 2014 Hisham H. Muhammad
(C) 2020-2023 htop dev team
(C) 2020-2023 Red Hat, Inc.
diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessTable.c
index 69c04e22..3c7cb475 100644
--- a/pcp/PCPProcessList.c
+++ b/pcp/PCPProcessTable.c
@@ -1,5 +1,5 @@
/*
-htop - PCPProcessList.c
+htop - PCPProcessTable.c
(C) 2014 Hisham H. Muhammad
(C) 2020-2021 htop dev team
(C) 2020-2021 Red Hat, Inc.
@@ -9,7 +9,7 @@ in the source distribution for its full text.
#include "config.h" // IWYU pragma: keep
-#include "pcp/PCPProcessList.h"
+#include "pcp/PCPProcessTable.h"
#include <assert.h>
#include <limits.h>
@@ -31,19 +31,19 @@ in the source distribution for its full text.
#include "pcp/PCPProcess.h"
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- PCPProcessList* this = xCalloc(1, sizeof(PCPProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ PCPProcessTable* this = xCalloc(1, sizeof(PCPProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(PCPProcess), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(PCPProcess), host, pidMatchList);
return super;
}
-void ProcessList_delete(Object* cast) {
- PCPProcessList* this = (PCPProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ PCPProcessTable* this = (PCPProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
@@ -112,7 +112,7 @@ static char* setUser(UsersTable* this, unsigned int uid, int pid, int offset) {
return name;
}
-static inline ProcessState PCPProcessList_getProcessState(char state) {
+static inline ProcessState PCPProcessTable_getProcessState(char state) {
switch (state) {
case '?': return UNKNOWN;
case 'R': return RUNNING;
@@ -129,13 +129,13 @@ static inline ProcessState PCPProcessList_getProcessState(char state) {
}
}
-static void PCPProcessList_updateID(Process* process, int pid, int offset) {
+static void PCPProcessTable_updateID(Process* process, int pid, int offset) {
Process_setThreadGroup(process, Metric_instance_u32(PCP_PROC_TGID, pid, offset, 1));
Process_setParent(process, Metric_instance_u32(PCP_PROC_PPID, pid, offset, 1));
- process->state = PCPProcessList_getProcessState(Metric_instance_char(PCP_PROC_STATE, pid, offset, '?'));
+ process->state = PCPProcessTable_getProcessState(Metric_instance_char(PCP_PROC_STATE, pid, offset, '?'));
}
-static void PCPProcessList_updateInfo(PCPProcess* pp, int pid, int offset, char* command, size_t commLen) {
+static void PCPProcessTable_updateInfo(PCPProcess* pp, int pid, int offset, char* command, size_t commLen) {
Process* process = &pp->super;
pmAtomValue value;
@@ -165,7 +165,7 @@ static void PCPProcessList_updateInfo(PCPProcess* pp, int pid, int offset, char*
process->time = pp->utime + pp->stime;
}
-static void PCPProcessList_updateIO(PCPProcess* pp, int pid, int offset, unsigned long long now) {
+static void PCPProcessTable_updateIO(PCPProcess* pp, int pid, int offset, unsigned long long now) {
pmAtomValue value;
pp->io_rchar = Metric_instance_ONE_K(PCP_PROC_IO_RCHAR, pid, offset);
@@ -197,7 +197,7 @@ static void PCPProcessList_updateIO(PCPProcess* pp, int pid, int offset, unsigne
pp->io_last_scan_time = now;
}
-static void PCPProcessList_updateMemory(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_updateMemory(PCPProcess* pp, int pid, int offset) {
pp->super.m_virt = Metric_instance_u32(PCP_PROC_MEM_SIZE, pid, offset, 0);
pp->super.m_resident = Metric_instance_u32(PCP_PROC_MEM_RSS, pid, offset, 0);
pp->m_share = Metric_instance_u32(PCP_PROC_MEM_SHARE, pid, offset, 0);
@@ -207,22 +207,22 @@ static void PCPProcessList_updateMemory(PCPProcess* pp, int pid, int offset) {
pp->m_dt = Metric_instance_u32(PCP_PROC_MEM_DIRTY, pid, offset, 0);
}
-static void PCPProcessList_updateSmaps(PCPProcess* pp, pid_t pid, int offset) {
+static void PCPProcessTable_updateSmaps(PCPProcess* pp, pid_t pid, int offset) {
pp->m_pss = Metric_instance_u64(PCP_PROC_SMAPS_PSS, pid, offset, 0);
pp->m_swap = Metric_instance_u64(PCP_PROC_SMAPS_SWAP, pid, offset, 0);
pp->m_psswp = Metric_instance_u64(PCP_PROC_SMAPS_SWAPPSS, pid, offset, 0);
}
-static void PCPProcessList_readOomData(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readOomData(PCPProcess* pp, int pid, int offset) {
pp->oom = Metric_instance_u32(PCP_PROC_OOMSCORE, pid, offset, 0);
}
-static void PCPProcessList_readAutogroup(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readAutogroup(PCPProcess* pp, int pid, int offset) {
pp->autogroup_id = Metric_instance_s64(PCP_PROC_AUTOGROUP_ID, pid, offset, -1);
pp->autogroup_nice = Metric_instance_s32(PCP_PROC_AUTOGROUP_NICE, pid, offset, 0);
}
-static void PCPProcessList_readCtxtData(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readCtxtData(PCPProcess* pp, int pid, int offset) {
pmAtomValue value;
unsigned long ctxt = 0;
@@ -246,28 +246,28 @@ static char* setString(Metric metric, int pid, int offset, char* string) {
return string;
}
-static void PCPProcessList_updateTTY(Process* process, int pid, int offset) {
+static void PCPProcessTable_updateTTY(Process* process, int pid, int offset) {
process->tty_name = setString(PCP_PROC_TTYNAME, pid, offset, process->tty_name);
}
-static void PCPProcessList_readCGroups(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readCGroups(PCPProcess* pp, int pid, int offset) {
pp->cgroup = setString(PCP_PROC_CGROUPS, pid, offset, pp->cgroup);
}
-static void PCPProcessList_readSecattrData(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readSecattrData(PCPProcess* pp, int pid, int offset) {
pp->secattr = setString(PCP_PROC_LABELS, pid, offset, pp->secattr);
}
-static void PCPProcessList_readCwd(PCPProcess* pp, int pid, int offset) {
+static void PCPProcessTable_readCwd(PCPProcess* pp, int pid, int offset) {
pp->super.procCwd = setString(PCP_PROC_CWD, pid, offset, pp->super.procCwd);
}
-static void PCPProcessList_updateUsername(Process* process, int pid, int offset, UsersTable* users) {
+static void PCPProcessTable_updateUsername(Process* process, int pid, int offset, UsersTable* users) {
process->st_uid = Metric_instance_u32(PCP_PROC_ID_UID, pid, offset, 0);
process->user = setUser(users, process->st_uid, pid, offset);
}
-static void PCPProcessList_updateCmdline(Process* process, int pid, int offset, const char* comm) {
+static void PCPProcessTable_updateCmdline(Process* process, int pid, int offset, const char* comm) {
pmAtomValue value;
if (!Metric_instance(PCP_PROC_PSARGS, pid, offset, &value, PM_TYPE_STRING)) {
if (process->state != ZOMBIE)
@@ -317,9 +317,9 @@ static void PCPProcessList_updateCmdline(Process* process, int pid, int offset,
}
}
-static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
- ProcessList* pl = (ProcessList*) this;
- Machine* host = pl->super.host;
+static bool PCPProcessTable_updateProcesses(PCPProcessTable* this) {
+ ProcessTable* pt = (ProcessTable*) this;
+ Machine* host = pt->super.host;
PCPMachine* phost = (PCPMachine*) host;
const Settings* settings = host->settings;
@@ -334,15 +334,15 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
while (Metric_iterate(PCP_PROC_PID, &pid, &offset)) {
bool preExisting;
- Process* proc = ProcessList_getProcess(pl, pid, &preExisting, PCPProcess_new);
+ Process* proc = ProcessTable_getProcess(pt, pid, &preExisting, PCPProcess_new);
PCPProcess* pp = (PCPProcess*) proc;
- PCPProcessList_updateID(proc, pid, offset);
+ PCPProcessTable_updateID(proc, pid, offset);
proc->isUserlandThread = Process_getPid(proc) != Process_getThreadGroup(proc);
pp->offset = offset >= 0 ? offset : 0;
/*
* These conditions will not trigger on first occurrence, cause we need to
- * add the process to the ProcessList and do all one time scans
+ * add the process to the ProcessTable and do all one time scans
* (e.g. parsing the cmdline to detect a kernel thread)
* But it will short-circuit subsequent scans.
*/
@@ -350,40 +350,40 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
proc->super.updated = true;
proc->super.show = false;
if (proc->state == RUNNING)
- pl->runningTasks++;
- pl->kernelThreads++;
- pl->totalTasks++;
+ pt->runningTasks++;
+ pt->kernelThreads++;
+ pt->totalTasks++;
continue;
}
if (preExisting && hideUserlandThreads && Process_isUserlandThread(proc)) {
proc->super.updated = true;
proc->super.show = false;
if (proc->state == RUNNING)
- pl->runningTasks++;
- pl->userlandThreads++;
- pl->totalTasks++;
+ pt->runningTasks++;
+ pt->userlandThreads++;
+ pt->totalTasks++;
continue;
}
if (flags & PROCESS_FLAG_IO)
- PCPProcessList_updateIO(pp, pid, offset, now);
+ PCPProcessTable_updateIO(pp, pid, offset, now);
- PCPProcessList_updateMemory(pp, pid, offset);
+ PCPProcessTable_updateMemory(pp, pid, offset);
if ((flags & PROCESS_FLAG_LINUX_SMAPS) &&
(Process_isKernelThread(proc) == false)) {
if (Metric_enabled(PCP_PROC_SMAPS_PSS))
- PCPProcessList_updateSmaps(pp, pid, offset);
+ PCPProcessTable_updateSmaps(pp, pid, offset);
}
char command[MAX_NAME + 1];
unsigned int tty_nr = proc->tty_nr;
unsigned long long int lasttimes = pp->utime + pp->stime;
- PCPProcessList_updateInfo(pp, pid, offset, command, sizeof(command));
+ PCPProcessTable_updateInfo(pp, pid, offset, command, sizeof(command));
proc->starttime_ctime += Platform_getBootTime();
if (tty_nr != proc->tty_nr)
- PCPProcessList_updateTTY(proc, pid, offset);
+ PCPProcessTable_updateTTY(proc, pid, offset);
proc->percent_cpu = NAN;
if (phost->period > 0.0) {
@@ -393,33 +393,33 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
proc->percent_mem = proc->m_resident / (double) host->totalMem * 100.0;
Process_updateCPUFieldWidths(proc->percent_cpu);
- PCPProcessList_updateUsername(proc, pid, offset, host->usersTable);
+ PCPProcessTable_updateUsername(proc, pid, offset, host->usersTable);
if (!preExisting) {
- PCPProcessList_updateCmdline(proc, pid, offset, command);
+ PCPProcessTable_updateCmdline(proc, pid, offset, command);
Process_fillStarttimeBuffer(proc);
- ProcessList_add(pl, proc);
+ ProcessTable_add(pt, proc);
} else if (settings->updateProcessNames && proc->state != ZOMBIE) {
- PCPProcessList_updateCmdline(proc, pid, offset, command);
+ PCPProcessTable_updateCmdline(proc, pid, offset, command);
}
if (flags & PROCESS_FLAG_LINUX_CGROUP)
- PCPProcessList_readCGroups(pp, pid, offset);
+ PCPProcessTable_readCGroups(pp, pid, offset);
if (flags & PROCESS_FLAG_LINUX_OOM)
- PCPProcessList_readOomData(pp, pid, offset);
+ PCPProcessTable_readOomData(pp, pid, offset);
if (flags & PROCESS_FLAG_LINUX_CTXT)
- PCPProcessList_readCtxtData(pp, pid, offset);
+ PCPProcessTable_readCtxtData(pp, pid, offset);
if (flags & PROCESS_FLAG_LINUX_SECATTR)
- PCPProcessList_readSecattrData(pp, pid, offset);
+ PCPProcessTable_readSecattrData(pp, pid, offset);
if (flags & PROCESS_FLAG_CWD)
- PCPProcessList_readCwd(pp, pid, offset);
+ PCPProcessTable_readCwd(pp, pid, offset);
if (flags & PROCESS_FLAG_LINUX_AUTOGROUP)
- PCPProcessList_readAutogroup(pp, pid, offset);
+ PCPProcessTable_readAutogroup(pp, pid, offset);
if (proc->state == ZOMBIE && !proc->cmdline && command[0]) {
Process_updateCmdline(proc, command, 0, strlen(command));
@@ -429,9 +429,9 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
}
if (Process_isKernelThread(proc)) {
- pl->kernelThreads++;
+ pt->kernelThreads++;
} else {
- pl->userlandThreads++;
+ pt->userlandThreads++;
}
}
@@ -439,15 +439,15 @@ static bool PCPProcessList_updateProcesses(PCPProcessList* this) {
proc->super.show = ! ((hideKernelThreads && Process_isKernelThread(proc)) ||
(hideUserlandThreads && Process_isUserlandThread(proc)));
- pl->totalTasks++;
+ pt->totalTasks++;
if (proc->state == RUNNING)
- pl->runningTasks++;
+ pt->runningTasks++;
proc->super.updated = true;
}
return true;
}
-void ProcessList_goThroughEntries(ProcessList* super) {
- PCPProcessList* this = (PCPProcessList*) super;
- PCPProcessList_updateProcesses(this);
+void ProcessTable_goThroughEntries(ProcessTable* super) {
+ PCPProcessTable* this = (PCPProcessTable*) super;
+ PCPProcessTable_updateProcesses(this);
}
diff --git a/pcp/PCPProcessList.h b/pcp/PCPProcessTable.h
index 47a36026..3515393f 100644
--- a/pcp/PCPProcessList.h
+++ b/pcp/PCPProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_PCPProcessList
-#define HEADER_PCPProcessList
+#ifndef HEADER_PCPProcessTable
+#define HEADER_PCPProcessTable
/*
-htop - PCPProcessList.h
+htop - PCPProcessTable.h
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
@@ -13,14 +13,14 @@ in the source distribution for its full text.
#include <sys/types.h>
#include "Hashtable.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "UsersTable.h"
#include "pcp/Platform.h"
-typedef struct PCPProcessList_ {
- ProcessList super;
-} PCPProcessList;
+typedef struct PCPProcessTable_ {
+ ProcessTable super;
+} PCPProcessTable;
#endif
diff --git a/pcp/Platform.c b/pcp/Platform.c
index cfcd36c6..83313338 100644
--- a/pcp/Platform.c
+++ b/pcp/Platform.c
@@ -34,7 +34,7 @@ in the source distribution for its full text.
#include "MemorySwapMeter.h"
#include "Meter.h"
#include "NetworkIOMeter.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "Settings.h"
#include "SwapMeter.h"
#include "SysArchMeter.h"
@@ -50,7 +50,7 @@ in the source distribution for its full text.
#include "pcp/PCPDynamicMeter.h"
#include "pcp/PCPDynamicScreen.h"
#include "pcp/PCPMachine.h"
-#include "pcp/PCPProcessList.h"
+#include "pcp/PCPProcessTable.h"
#include "zfs/ZfsArcMeter.h"
#include "zfs/ZfsArcStats.h"
#include "zfs/ZfsCompressedArcMeter.h"
diff --git a/solaris/SolarisProcess.c b/solaris/SolarisProcess.c
index 2ec3c1d5..35a462d7 100644
--- a/solaris/SolarisProcess.c
+++ b/solaris/SolarisProcess.c
@@ -14,7 +14,7 @@ in the source distribution for its full text.
#include <sys/syscall.h>
#include "Process.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "CRT.h"
#include "solaris/Platform.h"
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessTable.c
index 46067a7b..2d9e6a71 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessTable.c
@@ -1,5 +1,5 @@
/*
-htop - SolarisProcessList.c
+htop - SolarisProcessTable.c
(C) 2014 Hisham H. Muhammad
(C) 2017,2018 Guy M. Broome
Released under the GNU GPLv2+, see the COPYING file
@@ -7,7 +7,7 @@ in the source distribution for its full text.
*/
-#include "solaris/SolarisProcessList.h"
+#include "solaris/SolarisProcessTable.h"
#include <unistd.h>
#include <stdlib.h>
@@ -29,7 +29,7 @@ in the source distribution for its full text.
#define GZONE "global "
#define UZONE "unknown "
-static char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
+static char* SolarisProcessTable_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
char* zname;
if ( sproc->zoneid == 0 ) {
@@ -44,23 +44,23 @@ static char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sp
return zname;
}
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- SolarisProcessList* this = xCalloc(1, sizeof(SolarisProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ SolarisProcessTable* this = xCalloc(1, sizeof(SolarisProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(SolarisProcess), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(SolarisProcess), host, pidMatchList);
return super;
}
-void ProcessList_delete(Object* cast) {
- SolarisProcessList* this = (SolarisProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ SolarisProcessTable* this = (SolarisProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
-static void SolarisProcessList_updateExe(pid_t pid, Process* proc) {
+static void SolarisProcessTable_updateExe(pid_t pid, Process* proc) {
char path[32];
xSnprintf(path, sizeof(path), "/proc/%d/path/a.out", pid);
@@ -73,7 +73,7 @@ static void SolarisProcessList_updateExe(pid_t pid, Process* proc) {
Process_updateExe(proc, target);
}
-static void SolarisProcessList_updateCwd(pid_t pid, Process* proc) {
+static void SolarisProcessTable_updateCwd(pid_t pid, Process* proc) {
char path[32];
xSnprintf(path, sizeof(path), "/proc/%d/cwd", pid);
@@ -87,7 +87,7 @@ static void SolarisProcessList_updateCwd(pid_t pid, Process* proc) {
}
/* Taken from: https://docs.oracle.com/cd/E19253-01/817-6223/6mlkidlom/index.html#tbl-sched-state */
-static inline ProcessState SolarisProcessList_getProcessState(char state) {
+static inline ProcessState SolarisProcessTable_getProcessState(char state) {
switch (state) {
case 'S': return SLEEPING;
case 'R': return RUNNABLE;
@@ -105,14 +105,14 @@ static inline ProcessState SolarisProcessList_getProcessState(char state) {
* system for more info.
*/
-static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr) {
+static int SolarisProcessTable_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr) {
bool preExisting;
pid_t getpid;
// Setup process list
- ProcessList* pl = (ProcessList*) listptr;
- SolarisProcessList* spl = (SolarisProcessList*) listptr;
- Machine* host = pl->host;
+ ProcessTable* pt = (ProcessTable*) listptr;
+ SolarisProcessTable* spt = (SolarisProcessTable*) listptr;
+ Machine* host = pt->host;
id_t lwpid_real = _lwpsinfo->pr_lwpid;
if (lwpid_real > 1023) {
@@ -127,7 +127,7 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
getpid = lwpid;
}
- Process* proc = ProcessList_getProcess(pl, getpid, &preExisting, SolarisProcess_new);
+ Process* proc = ProcessTable_getProcess(pt, getpid, &preExisting, SolarisProcess_new);
SolarisProcess* sproc = (SolarisProcess*) proc;
const Settings* settings = host->settings;
@@ -140,7 +140,7 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
proc->priority = _lwpsinfo->pr_pri;
proc->nice = _lwpsinfo->pr_nice - NZERO;
proc->processor = _lwpsinfo->pr_onpro;
- proc->state = SolarisProcessList_getProcessState(_lwpsinfo->pr_sname);
+ proc->state = SolarisProcessTable_getProcessState(_lwpsinfo->pr_sname);
// NOTE: This 'percentage' is a 16-bit BINARY FRACTIONS where 1.0 = 0x8000
// Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html
// (accessed on 18 November 2017)
@@ -170,14 +170,14 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
sproc->realpid = _psinfo->pr_pid;
sproc->lwpid = lwpid_real;
sproc->zoneid = _psinfo->pr_zoneid;
- sproc->zname = SolarisProcessList_readZoneName(spl->kd, sproc);
- SolarisProcessList_updateExe(_psinfo->pr_pid, proc);
+ sproc->zname = SolarisProcessTable_readZoneName(spt->kd, sproc);
+ SolarisProcessTable_updateExe(_psinfo->pr_pid, proc);
Process_updateComm(proc, _psinfo->pr_fname);
Process_updateCmdline(proc, _psinfo->pr_psargs, 0, 0);
if (settings->ss->flags & PROCESS_FLAG_CWD) {
- SolarisProcessList_updateCwd(_psinfo->pr_pid, proc);
+ SolarisProcessTable_updateCwd(_psinfo->pr_pid, proc);
}
}
@@ -201,20 +201,20 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
// Update proc and thread counts based on settings
if (proc->isKernelThread && !settings->hideKernelThreads) {
- pl->kernelThreads += proc->nlwp;
- pl->totalTasks += proc->nlwp + 1;
+ pt->kernelThreads += proc->nlwp;
+ pt->totalTasks += proc->nlwp + 1;
if (proc->state == RUNNING) {
- pl->runningTasks++;
+ pt->runningTasks++;
}
} else if (!proc->isKernelThread) {
if (proc->state == RUNNING) {
- pl->runningTasks++;
+ pt->runningTasks++;
}
if (settings->hideUserlandThreads) {
- pl->totalTasks++;
+ pt->totalTasks++;
} else {
- pl->userlandThreads += proc->nlwp;
- pl->totalTasks += proc->nlwp + 1;
+ pt->userlandThreads += proc->nlwp;
+ pt->totalTasks += proc->nlwp + 1;
}
}
proc->show = !(settings->hideKernelThreads && proc->isKernelThread);
@@ -251,7 +251,7 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
}
Process_fillStarttimeBuffer(proc);
- ProcessList_add(pl, proc);
+ ProcessTable_add(pt, proc);
}
proc->super.updated = true;
@@ -261,7 +261,7 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
return 0;
}
-void ProcessList_goThroughEntries(ProcessList* super) {
+void ProcessTable_goThroughEntries(ProcessTable* super) {
super->kernelThreads = 1;
- proc_walk(&SolarisProcessList_walkproc, super, PR_WALK_LWP);
+ proc_walk(&SolarisProcessTable_walkproc, super, PR_WALK_LWP);
}
diff --git a/solaris/SolarisProcessList.h b/solaris/SolarisProcessTable.h
index d8280117..40480498 100644
--- a/solaris/SolarisProcessList.h
+++ b/solaris/SolarisProcessTable.h
@@ -1,7 +1,7 @@
-#ifndef HEADER_SolarisProcessList
-#define HEADER_SolarisProcessList
+#ifndef HEADER_SolarisProcessTable
+#define HEADER_SolarisProcessTable
/*
-htop - SolarisProcessList.h
+htop - SolarisProcessTable.h
(C) 2014 Hisham H. Muhammad
(C) 2017,2018 Guy M. Broome
Released under the GNU GPLv2+, see the COPYING file
@@ -20,14 +20,14 @@ in the source distribution for its full text.
#include <sys/sysinfo.h>
#include "Hashtable.h"
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "UsersTable.h"
#include "solaris/SolarisProcess.h"
-typedef struct SolarisProcessList_ {
- ProcessList super;
-} SolarisProcessList;
+typedef struct SolarisProcessTable_ {
+ ProcessTable super;
+} SolarisProcessTable;
#endif
diff --git a/unsupported/UnsupportedProcessList.h b/unsupported/UnsupportedProcessList.h
deleted file mode 100644
index 96efdcd2..00000000
--- a/unsupported/UnsupportedProcessList.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef HEADER_UnsupportedProcessList
-#define HEADER_UnsupportedProcessList
-/*
-htop - UnsupportedProcessList.h
-(C) 2014 Hisham H. Muhammad
-Released under the GNU GPLv2+, see the COPYING file
-in the source distribution for its full text.
-*/
-
-#include "ProcessList.h"
-
-
-typedef struct UnsupportedProcessList_ {
- ProcessList super;
-} UnsupportedProcessList;
-
-#endif
diff --git a/unsupported/UnsupportedProcessList.c b/unsupported/UnsupportedProcessTable.c
index 1e29c17a..e0325e4d 100644
--- a/unsupported/UnsupportedProcessList.c
+++ b/unsupported/UnsupportedProcessTable.c
@@ -1,40 +1,40 @@
/*
-htop - UnsupportedProcessList.c
+htop - UnsupportedProcessTable.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
-#include "UnsupportedProcessList.h"
+#include "UnsupportedProcessTable.h"
#include <stdlib.h>
#include <string.h>
-#include "ProcessList.h"
+#include "ProcessTable.h"
#include "UnsupportedProcess.h"
-ProcessList* ProcessList_new(Machine* host, Hashtable* pidMatchList) {
- UnsupportedProcessList* this = xCalloc(1, sizeof(UnsupportedProcessList));
- Object_setClass(this, Class(ProcessList));
+ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) {
+ UnsupportedProcessTable* this = xCalloc(1, sizeof(UnsupportedProcessTable));
+ Object_setClass(this, Class(ProcessTable));
- ProcessList* super = &this->super;
- ProcessList_init(super, Class(Process), host, pidMatchList);
+ ProcessTable* super = &this->super;
+ ProcessTable_init(super, Class(Process), host, pidMatchList);
return this;
}
-void ProcessList_delete(Object* cast) {
- UnsupportedProcessList* this = (UnsupportedProcessList*) cast;
- ProcessList_done(&this->super);
+void ProcessTable_delete(Object* cast) {
+ UnsupportedProcessTable* this = (UnsupportedProcessTable*) cast;
+ ProcessTable_done(&this->super);
free(this);
}
-void ProcessList_goThroughEntries(ProcessList* super) {
+void ProcessTable_goThroughEntries(ProcessTable* super) {
bool preExisting = true;
Process* proc;
- proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new);
+ proc = ProcessTable_getProcess(super, 1, &preExisting, UnsupportedProcess_new);
/* Empty values */
proc->time = proc->time + 10;
@@ -84,5 +84,5 @@ void ProcessList_goThroughEntries(ProcessList* super) {
proc->majflt = 20;
if (!preExisting)
- ProcessList_add(super, proc);
+ ProcessTable_add(super, proc);
}
diff --git a/unsupported/UnsupportedProcessTable.h b/unsupported/UnsupportedProcessTable.h
new file mode 100644
index 00000000..1de8087d
--- /dev/null
+++ b/unsupported/UnsupportedProcessTable.h
@@ -0,0 +1,17 @@
+#ifndef HEADER_UnsupportedProcessTable
+#define HEADER_UnsupportedProcessTable
+/*
+htop - UnsupportedProcessTable.h
+(C) 2014 Hisham H. Muhammad
+Released under the GNU GPLv2+, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "ProcessTable.h"
+
+
+typedef struct UnsupportedProcessTable_ {
+ ProcessTable super;
+} UnsupportedProcessTable;
+
+#endif

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