From a6822e98434cf7da6fab033898094976d881ee0f Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Fri, 4 Feb 2022 11:23:02 +0100 Subject: New upstream version 3.1.2 --- netbsd/NetBSDProcess.c | 6 +++--- netbsd/NetBSDProcessList.c | 29 +++++++++++++++-------------- netbsd/Platform.c | 3 ++- netbsd/Platform.h | 7 ++++--- 4 files changed, 24 insertions(+), 21 deletions(-) (limited to 'netbsd') diff --git a/netbsd/NetBSDProcess.c b/netbsd/NetBSDProcess.c index 1597ed3..8d2b4c4 100644 --- a/netbsd/NetBSDProcess.c +++ b/netbsd/NetBSDProcess.c @@ -138,7 +138,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, }, @@ -165,7 +165,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, }, @@ -211,7 +211,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { }; Process* NetBSDProcess_new(const Settings* settings) { - NetBSDProcess* this = xCalloc(sizeof(NetBSDProcess), 1); + NetBSDProcess* this = xCalloc(1, sizeof(NetBSDProcess)); Object_setClass(this, Class(NetBSDProcess)); Process_init(&this->super, settings); return &this->super; diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c index 379a491..ab0f0b7 100644 --- a/netbsd/NetBSDProcessList.c +++ b/netbsd/NetBSDProcessList.c @@ -331,31 +331,33 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) { int nlwps = 0; const struct kinfo_lwp* klwps = kvm_getlwps(this->kd, kproc->p_pid, kproc->p_paddr, sizeof(struct kinfo_lwp), &nlwps); + /* TODO: According to the link below, SDYING should be a regarded state */ + /* Taken from: https://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/sys/sys/proc.h */ switch (kproc->p_realstat) { - case SIDL: proc->state = 'I'; break; + case SIDL: proc->state = IDLE; break; case SACTIVE: // We only consider the first LWP with a one of the below states. for (int j = 0; j < nlwps; j++) { if (klwps) { switch (klwps[j].l_stat) { - case LSONPROC: proc->state = 'P'; break; - case LSRUN: proc->state = 'R'; break; - case LSSLEEP: proc->state = 'S'; break; - case LSSTOP: proc->state = 'T'; break; - default: proc->state = '?'; + case LSONPROC: proc->state = RUNNING; break; + case LSRUN: proc->state = RUNNABLE; break; + case LSSLEEP: proc->state = SLEEPING; break; + case LSSTOP: proc->state = STOPPED; break; + default: proc->state = UNKNOWN; } - if (proc->state != '?') + if (proc->state != UNKNOWN) break; } else { - proc->state = '?'; + proc->state = UNKNOWN; break; } } break; - case SSTOP: proc->state = 'T'; break; - case SZOMB: proc->state = 'Z'; break; - case SDEAD: proc->state = 'D'; break; - default: proc->state = '?'; + case SSTOP: proc->state = STOPPED; break; + case SZOMB: proc->state = ZOMBIE; break; + case SDEAD: proc->state = DEFUNCT; break; + default: proc->state = UNKNOWN; } if (Process_isKernelThread(proc)) { @@ -365,8 +367,7 @@ static void NetBSDProcessList_scanProcs(NetBSDProcessList* this) { } this->super.totalTasks++; - // SRUN ('R') means runnable, not running - if (proc->state == 'P') { + if (proc->state == RUNNING) { this->super.runningTasks++; } proc->updated = true; diff --git a/netbsd/Platform.c b/netbsd/Platform.c index ac81464..3b27548 100644 --- a/netbsd/Platform.c +++ b/netbsd/Platform.c @@ -174,8 +174,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/netbsd/Platform.h b/netbsd/Platform.h index 1d1115e..e650bcd 100644 --- a/netbsd/Platform.h +++ b/netbsd/Platform.h @@ -24,6 +24,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" @@ -42,7 +43,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); @@ -82,8 +83,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) { -- cgit v1.2.3