Make unsupported platform build again.

(Thanks @coypoop at #397 for the heads up!)
This commit is contained in:
Hisham 2016-02-14 11:45:47 -02:00
parent 0b70439316
commit ae823c375a
2 changed files with 29 additions and 27 deletions

View File

@ -19,9 +19,16 @@ in the source distribution for its full text.
/*{ /*{
#include "Action.h" #include "Action.h"
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "SignalsPanel.h"
#include "UnsupportedProcess.h" #include "UnsupportedProcess.h"
}*/ }*/
SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 },
};
unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
ProcessFieldData Process_fields[] = { ProcessFieldData Process_fields[] = {
@ -79,7 +86,12 @@ void Platform_setBindings(Htop_Action* keys) {
} }
int Platform_numberOfFields = 100; int Platform_numberOfFields = 100;
char* Process_pidFormat = "%7u ";
extern char Process_pidFormat[20];
ProcessPidColumn Process_pidColumns[] = {
{ .id = 0, .label = NULL },
};
int Platform_getUptime() { int Platform_getUptime() {
return 0; return 0;
@ -95,42 +107,26 @@ int Platform_getMaxPid() {
return 1; return 1;
} }
void Process_setupColumnWidths() {
int maxPid = Platform_getMaxPid();
if (maxPid == -1) return;
if (maxPid > 99999) {
Process_fields[PID].title = " PID ";
Process_fields[PPID].title = " PPID ";
Process_fields[TPGID].title = " TPGID ";
Process_fields[TGID].title = " TGID ";
Process_fields[PGRP].title = " PGRP ";
Process_fields[SESSION].title = " SESN ";
Process_pidFormat = "%7u ";
} else {
Process_fields[PID].title = " PID ";
Process_fields[PPID].title = " PPID ";
Process_fields[TPGID].title = "TPGID ";
Process_fields[TGID].title = " TGID ";
Process_fields[PGRP].title = " PGRP ";
Process_fields[SESSION].title = " SESN ";
Process_pidFormat = "%5u ";
}
}
double Platform_setCPUValues(Meter* this, int cpu) { double Platform_setCPUValues(Meter* this, int cpu) {
return 0.0; (void) this;
(void) cpu;
return 0.0;
} }
void Platform_setMemoryValues(Meter* this) { void Platform_setMemoryValues(Meter* this) {
(void) this;
} }
void Platform_setSwapValues(Meter* this) { void Platform_setSwapValues(Meter* this) {
(void) this;
} }
bool Process_isThread(Process* this) { bool Process_isThread(Process* this) {
(void) this;
return false; return false;
} }
char* Platform_getProcessEnv(pid_t pid) { char* Platform_getProcessEnv(pid_t pid) {
(void) pid;
return NULL; return NULL;
} }

View File

@ -12,8 +12,13 @@ in the source distribution for its full text.
#include "Action.h" #include "Action.h"
#include "BatteryMeter.h" #include "BatteryMeter.h"
#include "SignalsPanel.h"
#include "UnsupportedProcess.h" #include "UnsupportedProcess.h"
extern SignalItem Platform_signals[];
extern unsigned int Platform_numberOfSignals;
extern ProcessField Platform_defaultFields[]; extern ProcessField Platform_defaultFields[];
extern ProcessFieldData Process_fields[]; extern ProcessFieldData Process_fields[];
@ -23,7 +28,10 @@ extern MeterClass* Platform_meterTypes[];
void Platform_setBindings(Htop_Action* keys); void Platform_setBindings(Htop_Action* keys);
extern int Platform_numberOfFields; extern int Platform_numberOfFields;
extern char* Process_pidFormat;
extern char Process_pidFormat[20];
extern ProcessPidColumn Process_pidColumns[];
int Platform_getUptime(); int Platform_getUptime();
@ -31,8 +39,6 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen);
int Platform_getMaxPid(); int Platform_getMaxPid();
void Process_setupColumnWidths();
double Platform_setCPUValues(Meter* this, int cpu); double Platform_setCPUValues(Meter* this, int cpu);
void Platform_setMemoryValues(Meter* this); void Platform_setMemoryValues(Meter* this);