summaryrefslogtreecommitdiffstats
path: root/solaris
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-31 23:28:02 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commit61e14d4bb25268593019e6df3eb02264b4ac8e0e (patch)
tree910b68d9a5ee1c4d25b2cf3ee24abaaf3e6a096b /solaris
parentb23f8235e28472c410dcb00893e0e3d403892673 (diff)
Spacing around operators
Diffstat (limited to 'solaris')
-rw-r--r--solaris/Platform.c32
-rw-r--r--solaris/Platform.h10
-rw-r--r--solaris/SolarisProcessList.c62
-rw-r--r--solaris/SolarisProcessList.h2
4 files changed, 56 insertions, 50 deletions
diff --git a/solaris/Platform.c b/solaris/Platform.c
index be2d25ed..69777726 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -130,7 +130,7 @@ extern char Process_pidFormat[20];
int Platform_getUptime() {
int boot_time = 0;
int curr_time = time(NULL);
- struct utmpx * ent;
+ struct utmpx* ent;
while (( ent = getutxent() )) {
if ( !strcmp("system boot", ent->ut_line )) {
@@ -140,7 +140,7 @@ int Platform_getUptime() {
endutxent();
- return (curr_time-boot_time);
+ return (curr_time - boot_time);
}
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
@@ -151,9 +151,9 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
}
int Platform_getMaxPid() {
- kstat_ctl_t *kc = NULL;
- kstat_t *kshandle = NULL;
- kvar_t *ksvar = NULL;
+ kstat_ctl_t* kc = NULL;
+ kstat_t* kshandle = NULL;
+ kvar_t* ksvar = NULL;
int vproc = 32778; // Reasonable Solaris default
kc = kstat_open();
if (kc != NULL) { kshandle = kstat_lookup(kc,"unix",0,"var"); }
@@ -187,11 +187,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
v[CPU_METER_KERNEL] = cpuData->systemPercent;
v[CPU_METER_IRQ] = cpuData->irqPercent;
this->curItems = 4;
- percent = v[0]+v[1]+v[2]+v[3];
+ percent = v[0] + v[1] + v[2] + v[3];
} else {
v[2] = cpuData->systemAllPercent;
this->curItems = 3;
- percent = v[0]+v[1]+v[2];
+ percent = v[0] + v[1] + v[2];
}
percent = CLAMP(percent, 0.0, 100.0);
@@ -228,8 +228,8 @@ void Platform_setZfsCompressedArcValues(Meter* this) {
ZfsCompressedArcMeter_readStats(this, &(spl->zfs));
}
-static int Platform_buildenv(void *accum, struct ps_prochandle *Phandle, uintptr_t addr, const char *str) {
- envAccum *accump = accum;
+static int Platform_buildenv(void* accum, struct ps_prochandle* Phandle, uintptr_t addr, const char* str) {
+ envAccum* accump = accum;
(void) Phandle;
(void) addr;
size_t thissz = strlen(str);
@@ -247,16 +247,16 @@ char* Platform_getProcessEnv(pid_t pid) {
envAccum envBuilder;
pid_t realpid = pid / 1024;
int graberr;
- struct ps_prochandle *Phandle;
+ struct ps_prochandle* Phandle;
- if ((Phandle = Pgrab(realpid,PGRAB_RDONLY,&graberr)) == NULL)
+ if ((Phandle = Pgrab(realpid, PGRAB_RDONLY, &graberr)) == NULL)
return "Unable to read process environment.";
envBuilder.capacity = 4096;
envBuilder.size = 0;
envBuilder.env = xMalloc(envBuilder.capacity);
- (void) Penv_iter(Phandle,Platform_buildenv,&envBuilder);
+ (void) Penv_iter(Phandle, Platform_buildenv, &envBuilder);
Prelease(Phandle, 0);
@@ -270,10 +270,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
return false;
}
-bool Platform_getNetworkIO(unsigned long int *bytesReceived,
- unsigned long int *packetsReceived,
- unsigned long int *bytesTransmitted,
- unsigned long int *packetsTransmitted) {
+bool Platform_getNetworkIO(unsigned long int* bytesReceived,
+ unsigned long int* packetsReceived,
+ unsigned long int* bytesTransmitted,
+ unsigned long int* packetsTransmitted) {
// TODO
*bytesReceived = 0;
*packetsReceived = 0;
diff --git a/solaris/Platform.h b/solaris/Platform.h
index 8718dbfe..701bc77d 100644
--- a/solaris/Platform.h
+++ b/solaris/Platform.h
@@ -27,7 +27,7 @@ typedef struct envAccum_ {
size_t capacity;
size_t size;
size_t bytes;
- char *env;
+ char* env;
} envAccum;
extern double plat_loadavg[3];
@@ -66,9 +66,9 @@ char* Platform_getProcessEnv(pid_t pid);
bool Platform_getDiskIO(DiskIOData* data);
-bool Platform_getNetworkIO(unsigned long int *bytesReceived,
- unsigned long int *packetsReceived,
- unsigned long int *bytesTransmitted,
- unsigned long int *packetsTransmitted);
+bool Platform_getNetworkIO(unsigned long int* bytesReceived,
+ unsigned long int* packetsReceived,
+ unsigned long int* bytesTransmitted,
+ unsigned long int* packetsTransmitted);
#endif
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index cbef6c8f..31507506 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -64,12 +64,12 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
const SolarisProcessList* spl = (SolarisProcessList*) pl;
int cpus = pl->cpuCount;
- kstat_t *cpuinfo = NULL;
+ kstat_t* cpuinfo = NULL;
int kchain = 0;
- kstat_named_t *idletime = NULL;
- kstat_named_t *intrtime = NULL;
- kstat_named_t *krnltime = NULL;
- kstat_named_t *usertime = NULL;
+ kstat_named_t* idletime = NULL;
+ kstat_named_t* intrtime = NULL;
+ kstat_named_t* krnltime = NULL;
+ kstat_named_t* usertime = NULL;
double idlebuf = 0;
double intrbuf = 0;
double krnlbuf = 0;
@@ -94,16 +94,16 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
kchain = kstat_read(spl->kd, cpuinfo, NULL);
}
if (kchain != -1 ) {
- idletime = kstat_data_lookup(cpuinfo,"cpu_nsec_idle");
- intrtime = kstat_data_lookup(cpuinfo,"cpu_nsec_intr");
- krnltime = kstat_data_lookup(cpuinfo,"cpu_nsec_kernel");
- usertime = kstat_data_lookup(cpuinfo,"cpu_nsec_user");
+ idletime = kstat_data_lookup(cpuinfo, "cpu_nsec_idle");
+ intrtime = kstat_data_lookup(cpuinfo, "cpu_nsec_intr");
+ krnltime = kstat_data_lookup(cpuinfo, "cpu_nsec_kernel");
+ usertime = kstat_data_lookup(cpuinfo, "cpu_nsec_user");
}
assert( (idletime != NULL) && (intrtime != NULL)
&& (krnltime != NULL) && (usertime != NULL) );
- CPUData* cpuData = &(spl->cpus[i+arrskip]);
+ CPUData* cpuData = &(spl->cpus[i + arrskip]);
totaltime = (idletime->value.ui64 - cpuData->lidle)
+ (intrtime->value.ui64 - cpuData->lintr)
+ (krnltime->value.ui64 - cpuData->lkrnl)
@@ -158,9 +158,11 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
// Part 1 - physical memory
if (spl->kd != NULL && meminfo == NULL) {
// Look up the kstat chain just one, it never changes
- meminfo = kstat_lookup(spl->kd,"unix",0,"system_pages");
+ meminfo = kstat_lookup(spl->kd, "unix", 0, "system_pages");
+ }
+ if (meminfo != NULL) {
+ ksrphyserr = kstat_read(spl->kd, meminfo, NULL);
}
- if (meminfo != NULL) { ksrphyserr = kstat_read(spl->kd,meminfo,NULL); }
if (ksrphyserr != -1) {
totalmem_pgs = kstat_data_lookup(meminfo, "physmem");
freemem_pgs = kstat_data_lookup(meminfo, "freemem");
@@ -276,13 +278,13 @@ void ProcessList_delete(ProcessList* pl) {
* system for more info.
*/
-int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *listptr) {
+int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr) {
bool preExisting;
pid_t getpid;
// Setup process list
- ProcessList *pl = (ProcessList*) listptr;
- SolarisProcessList *spl = (SolarisProcessList*) listptr;
+ ProcessList* pl = (ProcessList*) listptr;
+ SolarisProcessList* spl = (SolarisProcessList*) listptr;
id_t lwpid_real = _lwpsinfo->pr_lwpid;
if (lwpid_real > 1023) return 0;
@@ -293,8 +295,8 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
} else {
getpid = lwpid;
}
- Process *proc = ProcessList_getProcess(pl, getpid, &preExisting, SolarisProcess_new);
- SolarisProcess *sproc = (SolarisProcess*) proc;
+ Process* proc = ProcessList_getProcess(pl, getpid, &preExisting, SolarisProcess_new);
+ SolarisProcess* sproc = (SolarisProcess*) proc;
// Common code pass 1
proc->show = false;
@@ -309,22 +311,22 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
// NOTE: This 'percentage' is a 16-bit BINARY FRACTIONS where 1.0 = 0x8000
// Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html
// (accessed on 18 November 2017)
- proc->percent_mem = ((uint16_t)_psinfo->pr_pctmem/(double)32768)*(double)100.0;
+ proc->percent_mem = ((uint16_t)_psinfo->pr_pctmem / (double)32768) * (double)100.0;
proc->st_uid = _psinfo->pr_euid;
proc->pgrp = _psinfo->pr_pgid;
proc->nlwp = _psinfo->pr_nlwp;
proc->tty_nr = _psinfo->pr_ttydev;
- proc->m_resident = _psinfo->pr_rssize/CRT_pageSizeKB;
- proc->m_size = _psinfo->pr_size/CRT_pageSizeKB;
+ proc->m_resident = _psinfo->pr_rssize / CRT_pageSizeKB;
+ proc->m_size = _psinfo->pr_size / CRT_pageSizeKB;
if (!preExisting) {
sproc->realpid = _psinfo->pr_pid;
sproc->lwpid = lwpid_real;
sproc->zoneid = _psinfo->pr_zoneid;
- sproc->zname = SolarisProcessList_readZoneName(spl->kd,sproc);
+ sproc->zname = SolarisProcessList_readZoneName(spl->kd, sproc);
proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid);
proc->comm = xStrdup(_psinfo->pr_fname);
- proc->commLen = strnlen(_psinfo->pr_fname,PRFNSZ);
+ proc->commLen = strnlen(_psinfo->pr_fname, PRFNSZ);
}
// End common code pass 1
@@ -334,7 +336,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
proc->tgid = (_psinfo->pr_ppid * 1024);
sproc->realppid = _psinfo->pr_ppid;
// See note above (in common section) about this BINARY FRACTION
- proc->percent_cpu = ((uint16_t)_psinfo->pr_pctcpu/(double)32768)*(double)100.0;
+ proc->percent_cpu = ((uint16_t)_psinfo->pr_pctcpu / (double)32768) * (double)100.0;
proc->time = _psinfo->pr_time.tv_sec;
if (!preExisting) { // Tasks done only for NEW processes
sproc->is_lwp = false;
@@ -344,7 +346,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
// Update proc and thread counts based on settings
if (sproc->kernel && !pl->settings->hideKernelThreads) {
pl->kernelThreads += proc->nlwp;
- pl->totalTasks += proc->nlwp+1;
+ pl->totalTasks += proc->nlwp + 1;
if (proc->state == 'O') pl->runningTasks++;
} else if (!sproc->kernel) {
if (proc->state == 'O') pl->runningTasks++;
@@ -352,12 +354,12 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
pl->totalTasks++;
} else {
pl->userlandThreads += proc->nlwp;
- pl->totalTasks += proc->nlwp+1;
+ pl->totalTasks += proc->nlwp + 1;
}
}
proc->show = !(pl->settings->hideKernelThreads && sproc->kernel);
} else { // We are not in the master LWP, so jump to the LWP handling code
- proc->percent_cpu = ((uint16_t)_lwpsinfo->pr_pctcpu/(double)32768)*(double)100.0;
+ proc->percent_cpu = ((uint16_t)_lwpsinfo->pr_pctcpu / (double)32768) * (double)100.0;
proc->time = _lwpsinfo->pr_time.tv_sec;
if (!preExisting) { // Tasks done only for NEW LWPs
sproc->is_lwp = true;
@@ -369,8 +371,12 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
}
// Top-level process only gets this for the representative LWP
- if (sproc->kernel && !pl->settings->hideKernelThreads) proc->show = true;
- if (!sproc->kernel && !pl->settings->hideUserlandThreads) proc->show = true;
+ if (sproc->kernel && !pl->settings->hideKernelThreads) {
+ proc->show = true;
+ }
+ if (!sproc->kernel && !pl->settings->hideUserlandThreads) {
+ proc->show = true;
+ }
} // Top-level LWP or subordinate LWP
// Common code pass 2
diff --git a/solaris/SolarisProcessList.h b/solaris/SolarisProcessList.h
index 3a653eed..f800d9da 100644
--- a/solaris/SolarisProcessList.h
+++ b/solaris/SolarisProcessList.h
@@ -58,7 +58,7 @@ void ProcessList_delete(ProcessList* pl);
* system for more info.
*/
-int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *listptr);
+int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);

© 2014-2024 Faster IT GmbH | imprint | privacy policy