htop/unsupported/Platform.c

165 lines
3.4 KiB
C
Raw Normal View History

/*
htop - unsupported/Platform.c
(C) 2014 Hisham H. Muhammad
2015-07-12 16:26:33 +00:00
(C) 2015 David C. Hunt
Released under the GNU GPLv2+, see the COPYING file
in the source distribution for its full text.
*/
2021-01-28 17:19:38 +00:00
#include "config.h" // IWYU pragma: keep
#include "unsupported/Platform.h"
2021-01-28 17:19:38 +00:00
#include <math.h>
#include "CPUMeter.h"
#include "ClockMeter.h"
#include "DateMeter.h"
#include "DateTimeMeter.h"
#include "HostnameMeter.h"
2021-01-28 17:19:38 +00:00
#include "LoadAverageMeter.h"
#include "Macros.h"
#include "MemoryMeter.h"
#include "MemorySwapMeter.h"
2021-01-28 17:19:38 +00:00
#include "SwapMeter.h"
#include "SysArchMeter.h"
2021-01-28 17:19:38 +00:00
#include "TasksMeter.h"
2014-11-27 21:41:14 +00:00
#include "UptimeMeter.h"
const ScreenDefaults Platform_defaultScreens[] = {
{
.name = "Main",
.columns = "PID USER PRIORITY NICE M_VIRT M_RESIDENT STATE PERCENT_CPU PERCENT_MEM TIME COMM",
.sortKey = "PERCENT_CPU",
},
};
const unsigned int Platform_numberOfDefaultScreens = ARRAYSIZE(Platform_defaultScreens);
const SignalItem Platform_signals[] = {
{ .name = " 0 Cancel", .number = 0 },
};
2020-10-03 20:00:27 +00:00
const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
2020-10-05 11:19:50 +00:00
const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class,
&ClockMeter_class,
&DateMeter_class,
&DateTimeMeter_class,
&LoadAverageMeter_class,
&LoadMeter_class,
&MemoryMeter_class,
&SwapMeter_class,
&MemorySwapMeter_class,
&TasksMeter_class,
&BatteryMeter_class,
&HostnameMeter_class,
&SysArchMeter_class,
2014-11-27 21:41:14 +00:00
&UptimeMeter_class,
&AllCPUsMeter_class,
&AllCPUs2Meter_class,
&AllCPUs4Meter_class,
&AllCPUs8Meter_class,
&LeftCPUsMeter_class,
&RightCPUsMeter_class,
&LeftCPUs2Meter_class,
&RightCPUs2Meter_class,
&LeftCPUs4Meter_class,
&RightCPUs4Meter_class,
&LeftCPUs8Meter_class,
&RightCPUs8Meter_class,
&BlankMeter_class,
NULL
};
static const char Platform_unsupported[] = "unsupported";
bool Platform_init(void) {
/* no platform-specific setup needed */
return true;
}
void Platform_done(void) {
/* no platform-specific cleanup needed */
}
void Platform_setBindings(Htop_Action* keys) {
/* no platform-specific key bindings */
(void) keys;
}
2014-11-27 21:41:14 +00:00
int Platform_getUptime() {
2015-07-12 16:26:33 +00:00
return 0;
2014-11-27 21:41:14 +00:00
}
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
*one = 0;
*five = 0;
*fifteen = 0;
}
int Platform_getMaxPid() {
2015-07-12 16:26:33 +00:00
return 1;
}
double Platform_setCPUValues(Meter* this, unsigned int cpu) {
(void) cpu;
double* v = this->values;
v[CPU_METER_FREQUENCY] = NAN;
v[CPU_METER_TEMPERATURE] = NAN;
2021-01-28 17:19:38 +00:00
this->curItems = 1;
return 0.0;
2015-07-12 16:26:33 +00:00
}
void Platform_setMemoryValues(Meter* this) {
(void) this;
2015-07-12 16:26:33 +00:00
}
void Platform_setSwapValues(Meter* this) {
(void) this;
2015-07-12 16:26:33 +00:00
}
char* Platform_getProcessEnv(pid_t pid) {
(void) pid;
return NULL;
}
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
2021-07-14 17:15:09 +00:00
(void)pid;
(void)inode;
return NULL;
}
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
2021-07-14 17:15:09 +00:00
(void)pid;
return NULL;
}
bool Platform_getDiskIO(DiskIOData* data) {
(void)data;
return false;
}
2020-10-08 14:34:54 +00:00
bool Platform_getNetworkIO(NetworkIOData* data) {
(void)data;
return false;
2020-10-08 14:34:54 +00:00
}
void Platform_getBattery(double* percent, ACPresence* isOnAC) {
*percent = NAN;
*isOnAC = AC_ERROR;
}
void Platform_getHostname(char* buffer, size_t size) {
String_safeStrncpy(buffer, Platform_unsupported, size);
}
void Platform_getRelease(char** string) {
2021-07-14 17:15:09 +00:00
*string = xStrdup(Platform_unsupported);
}