summaryrefslogtreecommitdiffstats
path: root/unsupported
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-01-28 18:19:38 +0100
committercgzones <cgzones@googlemail.com>2021-01-29 14:12:44 +0100
commit3acf28c259f1a393badcc2e99c9646e19a911f98 (patch)
tree78ea9191604c1aca520d358af0927b2c007dbf78 /unsupported
parentbd694c0ce60a60e29dc4ae22923f251fbd196332 (diff)
Unsupported: pass compilation
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/Platform.c17
-rw-r--r--unsupported/Platform.h1
-rw-r--r--unsupported/UnsupportedProcess.c69
-rw-r--r--unsupported/UnsupportedProcess.h13
-rw-r--r--unsupported/UnsupportedProcessList.c13
-rw-r--r--unsupported/UnsupportedProcessList.h3
6 files changed, 95 insertions, 21 deletions
diff --git a/unsupported/Platform.c b/unsupported/Platform.c
index 94e1b7c7..de231b5c 100644
--- a/unsupported/Platform.c
+++ b/unsupported/Platform.c
@@ -6,19 +6,22 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include <math.h>
+#include "config.h" // IWYU pragma: keep
#include "Platform.h"
-#include "Macros.h"
+
+#include <math.h>
+
#include "CPUMeter.h"
-#include "MemoryMeter.h"
-#include "SwapMeter.h"
-#include "TasksMeter.h"
-#include "LoadAverageMeter.h"
#include "ClockMeter.h"
#include "DateMeter.h"
#include "DateTimeMeter.h"
#include "HostnameMeter.h"
+#include "LoadAverageMeter.h"
+#include "Macros.h"
+#include "MemoryMeter.h"
+#include "SwapMeter.h"
+#include "TasksMeter.h"
#include "UptimeMeter.h"
@@ -93,6 +96,8 @@ double Platform_setCPUValues(Meter* this, int cpu) {
v[CPU_METER_FREQUENCY] = NAN;
v[CPU_METER_TEMPERATURE] = NAN;
+ this->curItems = 1;
+
return 0.0;
}
diff --git a/unsupported/Platform.h b/unsupported/Platform.h
index 4254122e..8f57e833 100644
--- a/unsupported/Platform.h
+++ b/unsupported/Platform.h
@@ -15,6 +15,7 @@ in the source distribution for its full text.
#include "SignalsPanel.h"
#include "UnsupportedProcess.h"
+
extern const SignalItem Platform_signals[];
extern const unsigned int Platform_numberOfSignals;
diff --git a/unsupported/UnsupportedProcess.c b/unsupported/UnsupportedProcess.c
index 0f1f0f8c..4f77eee9 100644
--- a/unsupported/UnsupportedProcess.c
+++ b/unsupported/UnsupportedProcess.c
@@ -5,10 +5,16 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include "Process.h"
+#include "config.h" // IWYU pragma: keep
+
#include "UnsupportedProcess.h"
+
#include <stdlib.h>
+#include "CRT.h"
+#include "Process.h"
+
+
const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
[0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, },
[PID] = { .name = "PID", .title = "PID", .description = "Process/thread ID", .flags = 0, .pidColumn = true, },
@@ -37,17 +43,62 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
[TGID] = { .name = "TGID", .title = "TGID", .description = "Thread group ID (i.e. process ID)", .flags = 0, .pidColumn = true, },
};
-Process* UnsupportedProcess_new(Settings* settings) {
- Process* this = xCalloc(1, sizeof(Process));
- Object_setClass(this, Class(Process));
+Process* UnsupportedProcess_new(const Settings* settings) {
+ Process* this = xCalloc(1, sizeof(UnsupportedProcess));
+ Object_setClass(this, Class(UnsupportedProcess));
Process_init(this, settings);
return this;
}
-void UnsupportedProcess_delete(Object* cast) {
- Process* this = (Process*) cast;
- Object_setClass(this, Class(Process));
- Process_done((Process*)cast);
+void Process_delete(Object* cast) {
+ Process* super = (Process*) cast;
+ Process_done(super);
// free platform-specific fields here
- free(this);
+ free(cast);
+}
+
+static void UnsupportedProcess_writeField(const Process* this, RichString* str, ProcessField field) {
+ const UnsupportedProcess* up = (const UnsupportedProcess*) this;
+ bool coloring = this->settings->highlightMegabytes;
+ char buffer[256]; buffer[255] = '\0';
+ int attr = CRT_colors[DEFAULT_COLOR];
+ size_t n = sizeof(buffer) - 1;
+
+ (void) up;
+ (void) coloring;
+ (void) n;
+
+ switch (field) {
+ /* Add platform specific fields */
+ default:
+ Process_writeField(this, str, field);
+ return;
+ }
+ RichString_appendWide(str, attr, buffer);
+}
+
+static int UnsupportedProcess_compareByKey(const Process* v1, const Process* v2, ProcessField key) {
+ const UnsupportedProcess* p1 = (const UnsupportedProcess*)v1;
+ const UnsupportedProcess* p2 = (const UnsupportedProcess*)v2;
+
+ (void) p1;
+ (void) p2;
+
+ switch (key) {
+ /* Add platform specific fields */
+ default:
+ return Process_compareByKey_Base(v1, v2, key);
+ }
}
+
+const ProcessClass UnsupportedProcess_class = {
+ .super = {
+ .extends = Class(Process),
+ .display = Process_display,
+ .delete = Process_delete,
+ .compare = Process_compare
+ },
+ .writeField = UnsupportedProcess_writeField,
+ .getCommandStr = NULL,
+ .compareByKey = UnsupportedProcess_compareByKey
+};
diff --git a/unsupported/UnsupportedProcess.h b/unsupported/UnsupportedProcess.h
index e1812f16..2e104494 100644
--- a/unsupported/UnsupportedProcess.h
+++ b/unsupported/UnsupportedProcess.h
@@ -9,12 +9,19 @@ in the source distribution for its full text.
#include "Settings.h"
-#define Process_delete UnsupportedProcess_delete
+typedef struct UnsupportedProcess_ {
+ Process super;
+
+ /* Add platform specific fields */
+} UnsupportedProcess;
+
extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD];
-Process* UnsupportedProcess_new(Settings* settings);
+Process* UnsupportedProcess_new(const Settings* settings);
+
+void Process_delete(Object* cast);
-void UnsupportedProcess_delete(Object* cast);
+extern const ProcessClass UnsupportedProcess_class;
#endif
diff --git a/unsupported/UnsupportedProcessList.c b/unsupported/UnsupportedProcessList.c
index 098eb488..8bc42962 100644
--- a/unsupported/UnsupportedProcessList.c
+++ b/unsupported/UnsupportedProcessList.c
@@ -5,17 +5,21 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include "ProcessList.h"
-#include "UnsupportedProcess.h"
+#include "UnsupportedProcessList.h"
#include <stdlib.h>
#include <string.h>
+#include "ProcessList.h"
+#include "UnsupportedProcess.h"
+
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
ProcessList* this = xCalloc(1, sizeof(ProcessList));
ProcessList_init(this, Class(Process), usersTable, pidMatchList, userId);
+ this->cpuCount = 1;
+
return this;
}
@@ -41,7 +45,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
proc->pid = 1;
proc->ppid = 1;
proc->tgid = 0;
- proc->comm = "<unsupported architecture>";
+ free_and_xStrdup(&proc->comm, "<unsupported architecture>");
proc->basenameOffset = 0;
proc->updated = true;
@@ -70,4 +74,7 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
proc->minflt = 20;
proc->majflt = 20;
+
+ if (!preExisting)
+ ProcessList_add(super, proc);
}
diff --git a/unsupported/UnsupportedProcessList.h b/unsupported/UnsupportedProcessList.h
index 1c537713..83796899 100644
--- a/unsupported/UnsupportedProcessList.h
+++ b/unsupported/UnsupportedProcessList.h
@@ -7,6 +7,9 @@ Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
+#include "ProcessList.h"
+
+
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
void ProcessList_delete(ProcessList* this);

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