mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Use unsigned types for CPU counts and associated variables
This commit is contained in:

committed by
Benny Baumann

parent
53bcc5cbff
commit
a11d01568c
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user