summaryrefslogtreecommitdiffstats
path: root/solaris
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-31 22:14:27 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commitb23f8235e28472c410dcb00893e0e3d403892673 (patch)
treeaecb7abcfa9f48caf43c21c54544cb21c2f65112 /solaris
parent9a16b1079ec1e831a449eb23ff23bf13b1b2a935 (diff)
Whitespace and indentation issues
Diffstat (limited to 'solaris')
-rw-r--r--solaris/Platform.c6
-rw-r--r--solaris/SolarisProcessList.c54
2 files changed, 37 insertions, 23 deletions
diff --git a/solaris/Platform.c b/solaris/Platform.c
index 87247969..be2d25ed 100644
--- a/solaris/Platform.c
+++ b/solaris/Platform.c
@@ -172,10 +172,10 @@ double Platform_setCPUValues(Meter* this, int cpu) {
const CPUData* cpuData = NULL;
if (cpus == 1) {
- // single CPU box has everything in spl->cpus[0]
- cpuData = &(spl->cpus[0]);
+ // single CPU box has everything in spl->cpus[0]
+ cpuData = &(spl->cpus[0]);
} else {
- cpuData = &(spl->cpus[cpu]);
+ cpuData = &(spl->cpus[cpu]);
}
double percent;
diff --git a/solaris/SolarisProcessList.c b/solaris/SolarisProcessList.c
index e219d1ee..cbef6c8f 100644
--- a/solaris/SolarisProcessList.c
+++ b/solaris/SolarisProcessList.c
@@ -29,16 +29,18 @@ in the source distribution for its full text.
#define MAXCMDLINE 255
char* SolarisProcessList_readZoneName(kstat_ctl_t* kd, SolarisProcess* sproc) {
- char* zname;
- if ( sproc->zoneid == 0 ) {
- zname = xStrdup(GZONE);
- } else if ( kd == NULL ) {
- zname = xStrdup(UZONE);
- } else {
- kstat_t* ks = kstat_lookup( kd, "zones", sproc->zoneid, NULL );
- zname = xStrdup(ks == NULL ? UZONE : ks->ks_name);
- }
- return zname;
+ char* zname;
+
+ if ( sproc->zoneid == 0 ) {
+ zname = xStrdup(GZONE);
+ } else if ( kd == NULL ) {
+ zname = xStrdup(UZONE);
+ } else {
+ kstat_t* ks = kstat_lookup( kd, "zones", sproc->zoneid, NULL );
+ zname = xStrdup(ks == NULL ? UZONE : ks->ks_name);
+ }
+
+ return zname;
}
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
@@ -78,15 +80,19 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
assert(cpus > 0);
if (cpus > 1) {
- // Store values for the stats loop one extra element up in the array
- // to leave room for the average to be calculated afterwards
- arrskip++;
+ // Store values for the stats loop one extra element up in the array
+ // to leave room for the average to be calculated afterwards
+ arrskip++;
}
// Calculate per-CPU statistics first
for (int i = 0; i < cpus; i++) {
- if (spl->kd != NULL) { cpuinfo = kstat_lookup(spl->kd,"cpu",i,"sys"); }
- if (cpuinfo != NULL) { kchain = kstat_read(spl->kd,cpuinfo,NULL); }
+ if (spl->kd != NULL) {
+ cpuinfo = kstat_lookup(spl->kd, "cpu", i, "sys");
+ }
+ if (cpuinfo != NULL) {
+ 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");
@@ -170,7 +176,7 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
// Not really "buffers" but the best Solaris analogue that I can find to
// "memory in use but not by programs or the kernel itself"
pl->buffersMem = (totalmem_pgs->value.ui64 - pages->value.ui64) * CRT_pageSizeKB;
- } else {
+ } else {
// Fall back to basic sysconf if kstat isn't working
pl->totalMem = sysconf(_SC_PHYS_PAGES) * CRT_pageSize;
pl->buffersMem = 0;
@@ -180,8 +186,12 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
// Part 2 - swap
nswap = swapctl(SC_GETNSWP, NULL);
- if (nswap > 0) { sl = xMalloc((nswap * sizeof(swapent_t)) + sizeof(int)); }
- if (sl != NULL) { spathbase = xMalloc( nswap * MAXPATHLEN ); }
+ if (nswap > 0) {
+ sl = xMalloc((nswap * sizeof(swapent_t)) + sizeof(int));
+ }
+ if (sl != NULL) {
+ spathbase = xMalloc( nswap * MAXPATHLEN );
+ }
if (spathbase != NULL) {
spath = spathbase;
swapdev = sl->swt_ent;
@@ -211,8 +221,12 @@ static inline void SolarisProcessList_scanZfsArcstats(ProcessList* pl) {
int ksrphyserr = -1;
kstat_named_t *cur_kstat = NULL;
- if (spl->kd != NULL) { arcstats = kstat_lookup(spl->kd, "zfs", 0, "arcstats"); }
- if (arcstats != NULL) { ksrphyserr = kstat_read(spl->kd, arcstats, NULL); }
+ if (spl->kd != NULL) {
+ arcstats = kstat_lookup(spl->kd, "zfs", 0, "arcstats");
+ }
+ if (arcstats != NULL) {
+ ksrphyserr = kstat_read(spl->kd, arcstats, NULL);
+ }
if (ksrphyserr != -1) {
cur_kstat = kstat_data_lookup( arcstats, "size" );
spl->zfs.size = cur_kstat->value.ui64 / 1024;

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