From 7639d62459b306af0ba2f1f6d1cc549c6982944d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 19 Jan 2024 20:57:33 +0100 Subject: DragonFlyBSD: build fixes --- dragonflybsd/DragonFlyBSDMachine.c | 14 +++++++++++--- dragonflybsd/DragonFlyBSDMachine.h | 2 +- dragonflybsd/DragonFlyBSDProcessTable.c | 8 ++++---- dragonflybsd/Platform.c | 3 ++- 4 files changed, 18 insertions(+), 9 deletions(-) (limited to 'dragonflybsd') diff --git a/dragonflybsd/DragonFlyBSDMachine.c b/dragonflybsd/DragonFlyBSDMachine.c index fd5b58b6..d71778fa 100644 --- a/dragonflybsd/DragonFlyBSDMachine.c +++ b/dragonflybsd/DragonFlyBSDMachine.c @@ -119,7 +119,7 @@ Machine* Machine_new(UsersTable* usersTable, uid_t userId) { } void Machine_delete(Machine* super) { - const DragonFlyBSDMachine* this = (const DragonFlyBSDMachine*) super; + DragonFlyBSDMachine* this = (DragonFlyBSDMachine*) super; Machine_done(super); @@ -223,7 +223,7 @@ static void DragonFlyBSDMachine_scanCPUTime(Machine* super) { } static void DragonFlyBSDMachine_scanMemoryInfo(Machine* super) { - DragonFlyBSDMachine* this = (DragonFlyBSDProcessTable*) super; + DragonFlyBSDMachine* this = (DragonFlyBSDMachine*) super; // @etosan: // memory counter relationships seem to be these: @@ -319,7 +319,7 @@ retry: free(jails); } -char* DragonFlyBSDMachine_readJailName(DragonFlyBSDMachine* host, int jailid) { +char* DragonFlyBSDMachine_readJailName(const DragonFlyBSDMachine* host, int jailid) { char* hostname; char* jname; @@ -339,3 +339,11 @@ void Machine_scan(Machine* super) { DragonFlyBSDMachine_scanCPUTime(super); DragonFlyBSDMachine_scanJails(this); } + +bool Machine_isCPUonline(const Machine* host, unsigned int id) { + assert(id < host->existingCPUs); + (void)host; (void)id; + + // TODO: Support detecting online / offline CPUs. + return true; +} diff --git a/dragonflybsd/DragonFlyBSDMachine.h b/dragonflybsd/DragonFlyBSDMachine.h index 0d4d8ef1..31996a0e 100644 --- a/dragonflybsd/DragonFlyBSDMachine.h +++ b/dragonflybsd/DragonFlyBSDMachine.h @@ -56,6 +56,6 @@ typedef struct DragonFlyBSDMachine_ { unsigned long* cp_times_n; } DragonFlyBSDMachine; -char* DragonFlyBSDMachine_readJailName(DragonFlyBSDMachine* host, int jailid); +char* DragonFlyBSDMachine_readJailName(const DragonFlyBSDMachine* host, int jailid); #endif diff --git a/dragonflybsd/DragonFlyBSDProcessTable.c b/dragonflybsd/DragonFlyBSDProcessTable.c index e36086f2..b286219d 100644 --- a/dragonflybsd/DragonFlyBSDProcessTable.c +++ b/dragonflybsd/DragonFlyBSDProcessTable.c @@ -37,7 +37,7 @@ ProcessTable* ProcessTable_new(Machine* host, Hashtable* pidMatchList) { } void ProcessTable_delete(Object* cast) { - const DragonFlyBSDProcessTable* this = (DragonFlyBSDProcessTable*) cast; + DragonFlyBSDProcessTable* this = (DragonFlyBSDProcessTable*) cast; ProcessTable_done(&this->super); free(this); } @@ -130,8 +130,8 @@ static void DragonFlyBSDProcessTable_updateProcessName(kvm_t* kd, const struct k } void ProcessTable_goThroughEntries(ProcessTable* super) { - const Machine* host = super->host; - const DragonFlyMachine* dhost = (const DragonFlyMachine*) host; + const Machine* host = super->super.host; + const DragonFlyBSDMachine* dhost = (const DragonFlyBSDMachine*) host; const Settings* settings = host->settings; bool hideKernelThreads = settings->hideKernelThreads; @@ -216,7 +216,7 @@ void ProcessTable_goThroughEntries(ProcessTable* super) { proc->time = (kproc->kp_lwp.kl_uticks + kproc->kp_lwp.kl_sticks + kproc->kp_lwp.kl_iticks) / 10000; proc->percent_cpu = 100.0 * ((double)kproc->kp_lwp.kl_pctcpu / (double)dhost->kernelFScale); - proc->percent_mem = 100.0 * proc->m_resident / (double)(super->totalMem); + proc->percent_mem = 100.0 * proc->m_resident / (double)(super->super.host->totalMem); Process_updateCPUFieldWidths(proc->percent_cpu); if (proc->percent_cpu > 0.1) { diff --git a/dragonflybsd/Platform.c b/dragonflybsd/Platform.c index 25afa8b1..86cda9d8 100644 --- a/dragonflybsd/Platform.c +++ b/dragonflybsd/Platform.c @@ -34,6 +34,7 @@ in the source distribution for its full text. #include "TasksMeter.h" #include "UptimeMeter.h" #include "XUtils.h" +#include "dragonflybsd/DragonFlyBSDMachine.h" #include "dragonflybsd/DragonFlyBSDProcess.h" #include "dragonflybsd/DragonFlyBSDProcessTable.h" #include "generic/fdstat_sysctl.h" @@ -193,7 +194,7 @@ double Platform_setCPUValues(Meter* this, unsigned int cpu) { v[CPU_METER_NICE] = cpuData->nicePercent; v[CPU_METER_NORMAL] = cpuData->userPercent; - if (super->settings->detailedCPUTime) { + if (host->settings->detailedCPUTime) { v[CPU_METER_KERNEL] = cpuData->systemPercent; v[CPU_METER_IRQ] = cpuData->irqPercent; this->curItems = 4; -- cgit v1.2.3