From a11d01568c5e7bc5570fd48fa0703d837c4bcd84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 17 Feb 2021 17:38:35 +0100 Subject: Use unsigned types for CPU counts and associated variables --- solaris/Platform.c | 4 ++-- solaris/Platform.h | 2 +- solaris/SolarisProcessList.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'solaris') diff --git a/solaris/Platform.c b/solaris/Platform.c index aa000e29..cadf092c 100644 --- a/solaris/Platform.c +++ b/solaris/Platform.c @@ -177,9 +177,9 @@ int Platform_getMaxPid() { return vproc; } -double Platform_setCPUValues(Meter* this, int cpu) { +double Platform_setCPUValues(Meter* this, unsigned int cpu) { const SolarisProcessList* spl = (const SolarisProcessList*) this->pl; - int cpus = this->pl->cpuCount; + unsigned int cpus = this->pl->cpuCount; const CPUData* cpuData = NULL; if (cpus == 1) { diff --git a/solaris/Platform.h b/solaris/Platform.h index bacadf07..8d08ad99 100644 --- a/solaris/Platform.h +++ b/solaris/Platform.h @@ -59,7 +59,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen); int Platform_getMaxPid(void); -double Platform_setCPUValues(Meter* this, int cpu); +double Platform_setCPUValues(Meter* this, unsigned int cpu); void Platform_setMemoryValues(Meter* this); diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c index 1f24c9ab..5223addf 100644 --- a/solaris/SolarisProcessList.c +++ b/solaris/SolarisProcessList.c @@ -69,7 +69,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) { const SolarisProcessList* spl = (SolarisProcessList*) pl; - int cpus = pl->cpuCount; + unsigned int cpus = pl->cpuCount; kstat_t* cpuinfo = NULL; kstat_named_t* idletime = NULL; kstat_named_t* intrtime = NULL; @@ -91,7 +91,7 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) { } // Calculate per-CPU statistics first - for (int i = 0; i < cpus; i++) { + for (unsigned int i = 0; i < cpus; i++) { if (spl->kd != NULL) { if ((cpuinfo = kstat_lookup(spl->kd, "cpu", i, "sys")) != NULL) { if (kstat_read(spl->kd, cpuinfo, NULL) != -1) { -- cgit v1.2.3