aboutsummaryrefslogtreecommitdiffstats
path: root/solaris
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2022-02-04 11:23:04 +0100
committerDaniel Lange <DLange@git.local>2022-02-04 11:23:04 +0100
commit93c96b12c9cb349b762d38d69568d65cd3e4fbfd (patch)
tree9cb12bb8f6c16c23cbb19df65c2334449693187d /solaris
parentebf0c067a1fdd4b4779b9557552c2278755dcab4 (diff)
parenta6822e98434cf7da6fab033898094976d881ee0f (diff)
downloaddebian_htop-93c96b12c9cb349b762d38d69568d65cd3e4fbfd.tar.gz
debian_htop-93c96b12c9cb349b762d38d69568d65cd3e4fbfd.tar.bz2
debian_htop-93c96b12c9cb349b762d38d69568d65cd3e4fbfd.zip
Update upstream source from tag 'upstream/3.1.2'
Update to upstream version '3.1.2' with Debian dir 5ce130e9471b77941bbd217b5ea8b7b3419a91c6
Diffstat (limited to 'solaris')
-rw-r--r--solaris/Platform.c3
-rw-r--r--solaris/Platform.h7
-rw-r--r--solaris/SolarisProcess.c4
-rw-r--r--solaris/SolarisProcessList.c19
4 files changed, 24 insertions, 9 deletions
diff --git a/solaris/Platform.c b/solaris/Platform.c
index eabbab5..cdc79ae 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -122,8 +122,9 @@ const MeterClass* const Platform_meterTypes[] = {
NULL
};
-void Platform_init(void) {
+bool Platform_init(void) {
/* no platform-specific setup needed */
+ return true;
}
void Platform_done(void) {
diff --git a/solaris/Platform.h b/solaris/Platform.h
index a60b978..b140788 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -35,6 +35,7 @@ in the source distribution for its full text.
#include "NetworkIOMeter.h"
#include "ProcessLocksScreen.h"
#include "SignalsPanel.h"
+#include "CommandLine.h"
#include "generic/gettime.h"
#include "generic/hostname.h"
#include "generic/uname.h"
@@ -59,7 +60,7 @@ extern const ProcessField Platform_defaultFields[];
extern const MeterClass* const Platform_meterTypes[];
-void Platform_init(void);
+bool Platform_init(void);
void Platform_done(void);
@@ -105,8 +106,8 @@ static inline void Platform_getRelease(char** string) {
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }
-static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
- return false;
+static inline CommandLineStatus Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {
+ return STATUS_ERROR_EXIT;
}
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
diff --git a/solaris/SolarisProcess.c b/solaris/SolarisProcess.c
index c1f4958..b0f6d94 100644
--- a/solaris/SolarisProcess.c
+++ b/solaris/SolarisProcess.c
@@ -39,11 +39,11 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
[PROCESSOR] = { .name = "PROCESSOR", .title = "CPU ", .description = "Id of the CPU the process last executed on", .flags = 0, },
[M_VIRT] = { .name = "M_VIRT", .title = " VIRT ", .description = "Total program size in virtual memory", .flags = 0, .defaultSortDesc = true, },
[M_RESIDENT] = { .name = "M_RESIDENT", .title = " RES ", .description = "Resident set size, size of the text and data sections, plus stack usage", .flags = 0, .defaultSortDesc = true, },
- [ST_UID] = { .name = "ST_UID", .title = " UID ", .description = "User ID of the process owner", .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, .defaultSortDesc = true, },
[PERCENT_NORM_CPU] = { .name = "PERCENT_NORM_CPU", .title = "NCPU%", .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)", .flags = 0, .defaultSortDesc = true, },
[PERCENT_MEM] = { .name = "PERCENT_MEM", .title = "MEM% ", .description = "Percentage of the memory the process is using, based on resident memory size", .flags = 0, .defaultSortDesc = true, },
- [USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, },
+ [USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, },
[TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, .defaultSortDesc = true, },
[NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, },
[TGID] = { .name = "TGID", .title = "TGID", .description = "Thread group ID (i.e. process ID)", .flags = 0, .pidColumn = true, },
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index 33c6477..71e85fc 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -363,6 +363,19 @@ static void SolarisProcessList_updateCwd(pid_t pid, Process* proc) {
free_and_xStrdup(&proc->procCwd, target);
}
+/* Taken from: https://docs.oracle.com/cd/E19253-01/817-6223/6mlkidlom/index.html#tbl-sched-state */
+static inline ProcessState SolarisProcessList_getProcessState(char state) {
+ switch (state) {
+ case 'S': return SLEEPING;
+ case 'R': return RUNNABLE;
+ case 'O': return RUNNING;
+ case 'Z': return ZOMBIE;
+ case 'T': return STOPPED;
+ case 'I': return IDLE;
+ default: return UNKNOWN;
+ }
+}
+
/* NOTE: the following is a callback function of type proc_walk_f
* and MUST conform to the appropriate definition in order
* to work. See libproc(3LIB) on a Solaris or Illumos
@@ -402,7 +415,7 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
proc->priority = _lwpsinfo->pr_pri;
proc->nice = _lwpsinfo->pr_nice - NZERO;
proc->processor = _lwpsinfo->pr_onpro;
- proc->state = _lwpsinfo->pr_sname;
+ proc->state = SolarisProcessList_getProcessState(_lwpsinfo->pr_sname);
// NOTE: This 'percentage' is a 16-bit BINARY FRACTIONS where 1.0 = 0x8000
// Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html
// (accessed on 18 November 2017)
@@ -462,11 +475,11 @@ static int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo,
if (proc->isKernelThread && !pl->settings->hideKernelThreads) {
pl->kernelThreads += proc->nlwp;
pl->totalTasks += proc->nlwp + 1;
- if (proc->state == 'O') {
+ if (proc->state == RUNNING) {
pl->runningTasks++;
}
} else if (!proc->isKernelThread) {
- if (proc->state == 'O') {
+ if (proc->state == RUNNING) {
pl->runningTasks++;
}
if (pl->settings->hideUserlandThreads) {

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