mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Unsupported: pass compilation
This commit is contained in:
parent
bd694c0ce6
commit
3acf28c259
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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 UnsupportedProcess_delete(Object* cast);
|
||||
void Process_delete(Object* cast);
|
||||
|
||||
extern const ProcessClass UnsupportedProcess_class;
|
||||
|
||||
#endif
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user