From 65357c8c46154de4e4eca14075bfe5523bb5fc14 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Dec 2020 10:26:01 +0100 Subject: New upstream version 3.0.3 --- unsupported/Battery.c | 7 --- unsupported/Battery.h | 6 --- unsupported/Platform.c | 79 ++++++++++++++++++++++++++------ unsupported/Platform.h | 33 +++++++++++--- unsupported/UnsupportedCRT.c | 20 -------- unsupported/UnsupportedCRT.h | 12 ----- unsupported/UnsupportedProcess.c | 2 +- unsupported/UnsupportedProcess.h | 2 +- unsupported/UnsupportedProcessList.c | 88 +++++++++++++++++++----------------- unsupported/UnsupportedProcessList.h | 4 +- 10 files changed, 143 insertions(+), 110 deletions(-) delete mode 100644 unsupported/Battery.c delete mode 100644 unsupported/Battery.h delete mode 100644 unsupported/UnsupportedCRT.c delete mode 100644 unsupported/UnsupportedCRT.h (limited to 'unsupported') diff --git a/unsupported/Battery.c b/unsupported/Battery.c deleted file mode 100644 index 080cf54..0000000 --- a/unsupported/Battery.c +++ /dev/null @@ -1,7 +0,0 @@ - -#include "BatteryMeter.h" - -void Battery_getData(double* level, ACPresence* isOnAC) { - *level = -1; - *isOnAC = AC_ERROR; -} diff --git a/unsupported/Battery.h b/unsupported/Battery.h deleted file mode 100644 index 21a1579..0000000 --- a/unsupported/Battery.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef HEADER_Battery -#define HEADER_Battery - -void Battery_getData(double* level, ACPresence* isOnAC); - -#endif diff --git a/unsupported/Platform.c b/unsupported/Platform.c index 420dfb7..54fde50 100644 --- a/unsupported/Platform.c +++ b/unsupported/Platform.c @@ -2,17 +2,22 @@ htop - unsupported/Platform.c (C) 2014 Hisham H. Muhammad (C) 2015 David C. Hunt -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Platform.h" +#include "Macros.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 "UptimeMeter.h" @@ -21,9 +26,9 @@ const SignalItem Platform_signals[] = { { .name = " 0 Cancel", .number = 0 }, }; -const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem); +const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals); -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_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; ProcessFieldData Process_fields[] = { [0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, }, @@ -42,7 +47,7 @@ ProcessFieldData Process_fields[] = { [STARTTIME] = { .name = "STARTTIME", .title = "START ", .description = "Time the process was started", .flags = 0, }, [PROCESSOR] = { .name = "PROCESSOR", .title = "CPU ", .description = "Id of the CPU the process last executed on", .flags = 0, }, - [M_SIZE] = { .name = "M_SIZE", .title = " VIRT ", .description = "Total program size in virtual memory", .flags = 0, }, + [M_VIRT] = { .name = "M_VIRT", .title = " VIRT ", .description = "Total program size in virtual memory", .flags = 0, }, [M_RESIDENT] = { .name = "M_RESIDENT", .title = " RES ", .description = "Resident set size, size of the text and data sections, plus stack usage", .flags = 0, }, [ST_UID] = { .name = "ST_UID", .title = " UID ", .description = "User ID of the process owner", .flags = 0, }, [PERCENT_CPU] = { .name = "PERCENT_CPU", .title = "CPU% ", .description = "Percentage of the CPU time the process used in the last sampling", .flags = 0, }, @@ -54,9 +59,11 @@ ProcessFieldData Process_fields[] = { [100] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, }, }; -MeterClass* Platform_meterTypes[] = { +const MeterClass* const Platform_meterTypes[] = { &CPUMeter_class, &ClockMeter_class, + &DateMeter_class, + &DateTimeMeter_class, &LoadAverageMeter_class, &LoadMeter_class, &MemoryMeter_class, @@ -67,26 +74,39 @@ MeterClass* Platform_meterTypes[] = { &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 }; -void Platform_setBindings(Htop_Action* keys) { - (void) keys; -} - int Platform_numberOfFields = 100; -extern char Process_pidFormat[20]; - ProcessPidColumn Process_pidColumns[] = { { .id = 0, .label = NULL }, }; +void Platform_init(void) { + /* no platform-specific setup needed */ +} + +void Platform_done(void) { + /* no platform-specific cleanup needed */ +} + +void Platform_setBindings(Htop_Action* keys) { + /* no platform-specific key bindings */ + (void) keys; +} + int Platform_getUptime() { return 0; } @@ -105,7 +125,8 @@ double Platform_setCPUValues(Meter* this, int cpu) { (void) cpu; double* v = this->values; - v[CPU_METER_FREQUENCY] = -1; + v[CPU_METER_FREQUENCY] = NAN; + v[CPU_METER_TEMPERATURE] = NAN; return 0.0; } @@ -118,7 +139,7 @@ void Platform_setSwapValues(Meter* this) { (void) this; } -bool Process_isThread(Process* this) { +bool Process_isThread(const Process* this) { (void) this; return false; } @@ -127,3 +148,35 @@ char* Platform_getProcessEnv(pid_t pid) { (void) pid; return NULL; } + +char* Platform_getInodeFilename(pid_t pid, ino_t inode) { + (void)pid; + (void)inode; + return NULL; +} + +FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) { + (void)pid; + return NULL; +} + +bool Platform_getDiskIO(DiskIOData* data) { + (void)data; + return false; +} + +bool Platform_getNetworkIO(unsigned long int* bytesReceived, + unsigned long int* packetsReceived, + unsigned long int* bytesTransmitted, + unsigned long int* packetsTransmitted) { + *bytesReceived = 0; + *packetsReceived = 0; + *bytesTransmitted = 0; + *packetsTransmitted = 0; + return false; +} + +void Platform_getBattery(double* percent, ACPresence* isOnAC) { + *percent = NAN; + *isOnAC = AC_ERROR; +} diff --git a/unsupported/Platform.h b/unsupported/Platform.h index 2a3d768..d3f5d72 100644 --- a/unsupported/Platform.h +++ b/unsupported/Platform.h @@ -4,12 +4,14 @@ htop - unsupported/Platform.h (C) 2014 Hisham H. Muhammad (C) 2015 David C. Hunt -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ #include "Action.h" #include "BatteryMeter.h" +#include "DiskIOMeter.h" +#include "ProcessLocksScreen.h" #include "SignalsPanel.h" #include "UnsupportedProcess.h" @@ -21,9 +23,7 @@ extern ProcessField Platform_defaultFields[]; extern ProcessFieldData Process_fields[]; -extern MeterClass* Platform_meterTypes[]; - -void Platform_setBindings(Htop_Action* keys); +extern const MeterClass* const Platform_meterTypes[]; extern int Platform_numberOfFields; @@ -31,11 +31,17 @@ extern char Process_pidFormat[20]; extern ProcessPidColumn Process_pidColumns[]; -int Platform_getUptime(); +void Platform_init(void); + +void Platform_done(void); + +void Platform_setBindings(Htop_Action* keys); + +int Platform_getUptime(void); void Platform_getLoadAverage(double* one, double* five, double* fifteen); -int Platform_getMaxPid(); +int Platform_getMaxPid(void); double Platform_setCPUValues(Meter* this, int cpu); @@ -43,8 +49,21 @@ void Platform_setMemoryValues(Meter* this); void Platform_setSwapValues(Meter* this); -bool Process_isThread(Process* this); +bool Process_isThread(const Process* this); char* Platform_getProcessEnv(pid_t pid); +char* Platform_getInodeFilename(pid_t pid, ino_t inode); + +FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid); + +bool Platform_getDiskIO(DiskIOData* data); + +bool Platform_getNetworkIO(unsigned long int* bytesReceived, + unsigned long int* packetsReceived, + unsigned long int* bytesTransmitted, + unsigned long int* packetsTransmitted); + +void Platform_getBattery(double *percent, ACPresence *isOnAC); + #endif diff --git a/unsupported/UnsupportedCRT.c b/unsupported/UnsupportedCRT.c deleted file mode 100644 index 49cc5d0..0000000 --- a/unsupported/UnsupportedCRT.c +++ /dev/null @@ -1,20 +0,0 @@ -/* -htop - UnsupportedCRT.c -(C) 2014 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file -in the source distribution for its full text. -*/ - -#include "config.h" -#include "CRT.h" -#include -#include - -void CRT_handleSIGSEGV(int sgn) { - (void) sgn; - CRT_done(); - fprintf(stderr, "\n\nhtop " VERSION " aborting.\n"); - fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!"); - fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n"); - abort(); -} diff --git a/unsupported/UnsupportedCRT.h b/unsupported/UnsupportedCRT.h deleted file mode 100644 index 24d63e5..0000000 --- a/unsupported/UnsupportedCRT.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef HEADER_UnsupportedCRT -#define HEADER_UnsupportedCRT -/* -htop - UnsupportedCRT.h -(C) 2014 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file -in the source distribution for its full text. -*/ - -void CRT_handleSIGSEGV(int sgn); - -#endif diff --git a/unsupported/UnsupportedProcess.c b/unsupported/UnsupportedProcess.c index 63e26ad..0827c60 100644 --- a/unsupported/UnsupportedProcess.c +++ b/unsupported/UnsupportedProcess.c @@ -1,7 +1,7 @@ /* htop - UnsupportedProcess.c (C) 2015 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ diff --git a/unsupported/UnsupportedProcess.h b/unsupported/UnsupportedProcess.h index dbe9bf5..11335cd 100644 --- a/unsupported/UnsupportedProcess.h +++ b/unsupported/UnsupportedProcess.h @@ -3,7 +3,7 @@ /* htop - UnsupportedProcess.h (C) 2015 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ diff --git a/unsupported/UnsupportedProcessList.c b/unsupported/UnsupportedProcessList.c index fc8a54d..098eb48 100644 --- a/unsupported/UnsupportedProcessList.c +++ b/unsupported/UnsupportedProcessList.c @@ -1,7 +1,7 @@ /* htop - UnsupportedProcessList.c (C) 2014 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ @@ -24,44 +24,50 @@ void ProcessList_delete(ProcessList* this) { free(this); } -void ProcessList_goThroughEntries(ProcessList* super) { - bool preExisting = true; - Process *proc; - - proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new); - - /* Empty values */ - proc->time = proc->time + 10; - proc->pid = 1; - proc->ppid = 1; - proc->tgid = 0; - proc->comm = ""; - proc->basenameOffset = 0; - proc->updated = true; - - proc->state = 'R'; - proc->show = true; /* Reflected in proc->settings-> "hideXXX" really */ - proc->pgrp = 0; - proc->session = 0; - proc->tty_nr = 0; - proc->tpgid = 0; - proc->st_uid = 0; - proc->flags = 0; - proc->processor = 0; - - proc->percent_cpu = 2.5; - proc->percent_mem = 2.5; - proc->user = "nobody"; - - proc->priority = 0; - proc->nice = 0; - proc->nlwp = 1; - strncpy(proc->starttime_show, "Jun 01 ", sizeof(proc->starttime_show)); - proc->starttime_ctime = 1433116800; // Jun 01, 2015 - - proc->m_size = 100; - proc->m_resident = 100; - - proc->minflt = 20; - proc->majflt = 20; +void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { + + // in pause mode only gather global data for meters (CPU/memory/...) + if (pauseProcessUpdate) { + return; + } + + bool preExisting = true; + Process* proc; + + proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new); + + /* Empty values */ + proc->time = proc->time + 10; + proc->pid = 1; + proc->ppid = 1; + proc->tgid = 0; + proc->comm = ""; + proc->basenameOffset = 0; + proc->updated = true; + + proc->state = 'R'; + proc->show = true; /* Reflected in proc->settings-> "hideXXX" really */ + proc->pgrp = 0; + proc->session = 0; + proc->tty_nr = 0; + proc->tpgid = 0; + proc->st_uid = 0; + proc->flags = 0; + proc->processor = 0; + + proc->percent_cpu = 2.5; + proc->percent_mem = 2.5; + proc->user = "nobody"; + + proc->priority = 0; + proc->nice = 0; + proc->nlwp = 1; + proc->starttime_ctime = 1433116800; // Jun 01, 2015 + Process_fillStarttimeBuffer(proc); + + proc->m_virt = 100; + proc->m_resident = 100; + + proc->minflt = 20; + proc->majflt = 20; } diff --git a/unsupported/UnsupportedProcessList.h b/unsupported/UnsupportedProcessList.h index c4b51ac..1c53771 100644 --- a/unsupported/UnsupportedProcessList.h +++ b/unsupported/UnsupportedProcessList.h @@ -3,7 +3,7 @@ /* htop - UnsupportedProcessList.h (C) 2014 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file +Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ @@ -11,6 +11,6 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui void ProcessList_delete(ProcessList* this); -void ProcessList_goThroughEntries(ProcessList* super); +void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate); #endif -- cgit v1.2.3