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 --- dragonflybsd/DragonFlyBSDProcess.c | 4 ++-- dragonflybsd/DragonFlyBSDProcessList.c | 41 +++++++++++++++++----------------- dragonflybsd/Platform.c | 3 ++- dragonflybsd/Platform.h | 7 +++--- 4 files changed, 29 insertions(+), 26 deletions(-) (limited to 'dragonflybsd') diff --git a/dragonflybsd/DragonFlyBSDProcess.c b/dragonflybsd/DragonFlyBSDProcess.c index a091cc6..ceb346c 100644 --- a/dragonflybsd/DragonFlyBSDProcess.c +++ b/dragonflybsd/DragonFlyBSDProcess.c @@ -37,11 +37,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/dragonflybsd/DragonFlyBSDProcessList.c b/dragonflybsd/DragonFlyBSDProcessList.c index e44c164..86586a8 100644 --- a/dragonflybsd/DragonFlyBSDProcessList.c +++ b/dragonflybsd/DragonFlyBSDProcessList.c @@ -79,8 +79,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* dynamicMeters, H size_t sizeof_cp_time_array = sizeof(unsigned long) * CPUSTATES; len = 2; sysctlnametomib("kern.cp_time", MIB_kern_cp_time, &len); - dfpl->cp_time_o = xCalloc(cpus, sizeof_cp_time_array); - dfpl->cp_time_n = xCalloc(cpus, sizeof_cp_time_array); + dfpl->cp_time_o = xCalloc(CPUSTATES, sizeof(unsigned long)); + dfpl->cp_time_n = xCalloc(CPUSTATES, sizeof(unsigned long)); len = sizeof_cp_time_array; // fetch initial single (or average) CPU clicks from kernel @@ -542,60 +542,61 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) { } // would be nice if we could store multiple states in proc->state (as enum) and have writeField render them + /* Taken from: https://github.com/DragonFlyBSD/DragonFlyBSD/blob/c163a4d7ee9c6857ee4e04a3a2cbb50c3de29da1/sys/sys/proc_common.h */ switch (kproc->kp_stat) { - case SIDL: proc->state = 'I'; isIdleProcess = true; break; + case SIDL: proc->state = IDLE; isIdleProcess = true; break; case SACTIVE: switch (kproc->kp_lwp.kl_stat) { case LSSLEEP: if (kproc->kp_lwp.kl_flags & LWP_SINTR) // interruptible wait short/long if (kproc->kp_lwp.kl_slptime >= MAXSLP) { - proc->state = 'I'; + proc->state = IDLE; isIdleProcess = true; } else { - proc->state = 'S'; + proc->state = SLEEPING; } else if (kproc->kp_lwp.kl_tdflags & TDF_SINTR) // interruptible lwkt wait - proc->state = 'S'; + proc->state = SLEEPING; else if (kproc->kp_paddr) // uninterruptible wait - proc->state = 'D'; + proc->state = UNINTERRUPTIBLE_WAIT; else // uninterruptible lwkt wait - proc->state = 'B'; + proc->state = UNINTERRUPTIBLE_WAIT; break; case LSRUN: if (kproc->kp_lwp.kl_stat == LSRUN) { if (!(kproc->kp_lwp.kl_tdflags & (TDF_RUNNING | TDF_RUNQ))) - proc->state = 'Q'; + proc->state = QUEUED; else - proc->state = 'R'; + proc->state = RUNNING; } break; case LSSTOP: - proc->state = 'T'; + proc->state = STOPPED; break; default: - proc->state = 'A'; + proc->state = PAGING; break; } break; - case SSTOP: proc->state = 'T'; break; - case SZOMB: proc->state = 'Z'; break; - case SCORE: proc->state = 'C'; break; - default: proc->state = '?'; + case SSTOP: proc->state = STOPPED; break; + case SZOMB: proc->state = ZOMBIE; break; + case SCORE: proc->state = BLOCKED; break; + default: proc->state = UNKNOWN; } if (kproc->kp_flags & P_SWAPPEDOUT) - proc->state = 'W'; + proc->state = SLEEPING; if (kproc->kp_flags & P_TRACED) - proc->state = 'T'; + proc->state = TRACED; if (kproc->kp_flags & P_JAILED) - proc->state = 'J'; + proc->state = TRACED; if (Process_isKernelThread(proc)) super->kernelThreads++; super->totalTasks++; - if (proc->state == 'R') + if (proc->state == RUNNING) super->runningTasks++; proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc))); diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index bb603cb..4941445 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -105,8 +105,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/dragonflybsd/Platform.h b/dragonflybsd/Platform.h index f3f2ec5..281a7ee 100644 --- a/dragonflybsd/Platform.h +++ b/dragonflybsd/Platform.h @@ -23,6 +23,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" @@ -36,7 +37,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); @@ -78,8 +79,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