aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/OpenBSDProcess.c6
-rw-r--r--openbsd/OpenBSDProcessList.c21
-rw-r--r--openbsd/Platform.c3
-rw-r--r--openbsd/Platform.h7
4 files changed, 20 insertions, 17 deletions
diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c
index 52dcb0e..ac3def3 100644
--- a/openbsd/OpenBSDProcess.c
+++ b/openbsd/OpenBSDProcess.c
@@ -136,7 +136,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
},
[ST_UID] = {
.name = "ST_UID",
- .title = " UID ",
+ .title = "UID",
.description = "User ID of the process owner",
.flags = 0,
},
@@ -163,7 +163,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
},
[USER] = {
.name = "USER",
- .title = "USER ",
+ .title = "USER ",
.description = "Username of the process owner (or user ID if name cannot be determined)",
.flags = 0,
},
@@ -203,7 +203,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = {
};
Process* OpenBSDProcess_new(const Settings* settings) {
- OpenBSDProcess* this = xCalloc(sizeof(OpenBSDProcess), 1);
+ OpenBSDProcess* this = xCalloc(1, sizeof(OpenBSDProcess));
Object_setClass(this, Class(OpenBSDProcess));
Process_init(&this->super, settings);
return &this->super;
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index 476af61..af7879e 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -345,15 +345,16 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
proc->user = UsersTable_getRef(this->super.usersTable, proc->st_uid);
}
+ /* Taken from: https://github.com/openbsd/src/blob/6a38af0976a6870911f4b2de19d8da28723a5778/sys/sys/proc.h#L420 */
switch (kproc->p_stat) {
- case SIDL: proc->state = 'I'; break;
- case SRUN: proc->state = 'P'; break;
- case SSLEEP: proc->state = 'S'; break;
- case SSTOP: proc->state = 'T'; break;
- case SZOMB: proc->state = 'Z'; break;
- case SDEAD: proc->state = 'D'; break;
- case SONPROC: proc->state = 'R'; break;
- default: proc->state = '?';
+ case SIDL: proc->state = IDLE; break;
+ case SRUN: proc->state = RUNNABLE; break;
+ case SSLEEP: proc->state = SLEEPING; break;
+ case SSTOP: proc->state = STOPPED; break;
+ case SZOMB: proc->state = ZOMBIE; break;
+ case SDEAD: proc->state = DEFUNCT; break;
+ case SONPROC: proc->state = RUNNING; break;
+ default: proc->state = UNKNOWN;
}
if (Process_isKernelThread(proc)) {
@@ -363,7 +364,7 @@ static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
}
this->super.totalTasks++;
- if (proc->state == 'R') {
+ if (proc->state == RUNNING) {
this->super.runningTasks++;
}
@@ -388,7 +389,7 @@ static void kernelCPUTimesToHtop(const u_int64_t* times, CPUData* cpu) {
unsigned long long sysAllTime = times[CP_INTR] + times[CP_SYS];
- // XXX Not sure if CP_SPIN should be added to sysAllTime.
+ // XXX Not sure if CP_SPIN should be added to sysAllTime.
// See https://github.com/openbsd/src/commit/531d8034253fb82282f0f353c086e9ad827e031c
#ifdef CP_SPIN
sysAllTime += times[CP_SPIN];
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index b941ba7..15467e1 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -121,8 +121,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/openbsd/Platform.h b/openbsd/Platform.h
index b6823b5..fd6a657 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -20,6 +20,7 @@ in the source distribution for its full text.
#include "Process.h"
#include "ProcessLocksScreen.h"
#include "SignalsPanel.h"
+#include "CommandLine.h"
#include "generic/gettime.h"
#include "generic/hostname.h"
#include "generic/uname.h"
@@ -34,7 +35,7 @@ extern const unsigned int Platform_numberOfSignals;
extern const MeterClass* const Platform_meterTypes[];
-void Platform_init(void);
+bool Platform_init(void);
void Platform_done(void);
@@ -76,8 +77,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) {

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