summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2023-11-23 12:22:02 +0100
committerBenBE <BenBE@geshi.org>2023-12-26 15:14:19 +0100
commit6aa9ef2726e42c4ae062b55be4d5cc015767d997 (patch)
treed5bd033946b404fa99b70b0b1c560725cef302bf /linux
parenta98fc47ffe67e88b1a83f94382795b8787a9bfe8 (diff)
Fix code style
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxMachine.c111
-rw-r--r--linux/LinuxProcess.c4
-rw-r--r--linux/LinuxProcessTable.c82
-rw-r--r--linux/Platform.c4
-rw-r--r--linux/SystemdMeter.c12
5 files changed, 107 insertions, 106 deletions
diff --git a/linux/LinuxMachine.c b/linux/LinuxMachine.c
index aa1ff5f8..d8d5fd2b 100644
--- a/linux/LinuxMachine.c
+++ b/linux/LinuxMachine.c
@@ -157,36 +157,36 @@ static void LinuxMachine_scanMemoryInfo(LinuxMachine* this) {
} else (void) 0 /* Require a ";" after the macro use. */
switch (buffer[0]) {
- case 'M':
- tryRead("MemAvailable:", availableMem);
- tryRead("MemFree:", freeMem);
- tryRead("MemTotal:", totalMem);
- break;
- case 'B':
- tryRead("Buffers:", buffersMem);
- break;
- case 'C':
- tryRead("Cached:", cachedMem);
- break;
- case 'S':
- switch (buffer[1]) {
- case 'h':
- tryRead("Shmem:", sharedMem);
+ case 'M':
+ tryRead("MemAvailable:", availableMem);
+ tryRead("MemFree:", freeMem);
+ tryRead("MemTotal:", totalMem);
break;
- case 'w':
- tryRead("SwapTotal:", swapTotalMem);
- tryRead("SwapCached:", swapCacheMem);
- tryRead("SwapFree:", swapFreeMem);
+ case 'B':
+ tryRead("Buffers:", buffersMem);
break;
- case 'R':
- tryRead("SReclaimable:", sreclaimableMem);
+ case 'C':
+ tryRead("Cached:", cachedMem);
+ break;
+ case 'S':
+ switch (buffer[1]) {
+ case 'h':
+ tryRead("Shmem:", sharedMem);
+ break;
+ case 'w':
+ tryRead("SwapTotal:", swapTotalMem);
+ tryRead("SwapCached:", swapCacheMem);
+ tryRead("SwapFree:", swapFreeMem);
+ break;
+ case 'R':
+ tryRead("SReclaimable:", sreclaimableMem);
+ break;
+ }
+ break;
+ case 'Z':
+ tryRead("Zswap:", zswapCompMem);
+ tryRead("Zswapped:", zswapOrigMem);
break;
- }
- break;
- case 'Z':
- tryRead("Zswap:", zswapCompMem);
- tryRead("Zswapped:", zswapOrigMem);
- break;
}
#undef tryRead
@@ -347,35 +347,36 @@ static void LinuxMachine_scanZfsArcstats(LinuxMachine* this) {
} else (void) 0 /* Require a ";" after the macro use. */
switch (buffer[0]) {
- case 'c':
- tryRead("c_min", &this->zfs.min);
- tryRead("c_max", &this->zfs.max);
- tryReadFlag("compressed_size", &this->zfs.compressed, this->zfs.isCompressed);
- break;
- case 'u':
- tryRead("uncompressed_size", &this->zfs.uncompressed);
- break;
- case 's':
- tryRead("size", &this->zfs.size);
- break;
- case 'h':
- tryRead("hdr_size", &this->zfs.header);
- break;
- case 'd':
- tryRead("dbuf_size", &dbufSize);
- tryRead("dnode_size", &dnodeSize);
- break;
- case 'b':
- tryRead("bonus_size", &bonusSize);
- break;
- case 'a':
- tryRead("anon_size", &this->zfs.anon);
- break;
- case 'm':
- tryRead("mfu_size", &this->zfs.MFU);
- tryRead("mru_size", &this->zfs.MRU);
- break;
+ case 'c':
+ tryRead("c_min", &this->zfs.min);
+ tryRead("c_max", &this->zfs.max);
+ tryReadFlag("compressed_size", &this->zfs.compressed, this->zfs.isCompressed);
+ break;
+ case 'u':
+ tryRead("uncompressed_size", &this->zfs.uncompressed);
+ break;
+ case 's':
+ tryRead("size", &this->zfs.size);
+ break;
+ case 'h':
+ tryRead("hdr_size", &this->zfs.header);
+ break;
+ case 'd':
+ tryRead("dbuf_size", &dbufSize);
+ tryRead("dnode_size", &dnodeSize);
+ break;
+ case 'b':
+ tryRead("bonus_size", &bonusSize);
+ break;
+ case 'a':
+ tryRead("anon_size", &this->zfs.anon);
+ break;
+ case 'm':
+ tryRead("mfu_size", &this->zfs.MFU);
+ tryRead("mru_size", &this->zfs.MRU);
+ break;
}
+
#undef tryRead
#undef tryReadFlag
}
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 8b119fd9..84141ec0 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -319,8 +319,8 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces
if (lp->autogroup_id != -1) {
xSnprintf(buffer, n, "%3d ", lp->autogroup_nice);
attr = lp->autogroup_nice < 0 ? CRT_colors[PROCESS_HIGH_PRIORITY]
- : lp->autogroup_nice > 0 ? CRT_colors[PROCESS_LOW_PRIORITY]
- : CRT_colors[PROCESS_SHADOW];
+ : lp->autogroup_nice > 0 ? CRT_colors[PROCESS_LOW_PRIORITY]
+ : CRT_colors[PROCESS_SHADOW];
} else {
attr = CRT_colors[PROCESS_SHADOW];
xSnprintf(buffer, n, "N/A ");
diff --git a/linux/LinuxProcessTable.c b/linux/LinuxProcessTable.c
index a4eb0264..aeda509e 100644
--- a/linux/LinuxProcessTable.c
+++ b/linux/LinuxProcessTable.c
@@ -516,33 +516,33 @@ static void LinuxProcessTable_readIoFile(LinuxProcess* lp, openat_arg_t procFd,
const char* line;
while ((line = strsep(&buf, "\n")) != NULL) {
switch (line[0]) {
- case 'r':
- if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
- lp->io_rchar = strtoull(line + 7, NULL, 10);
- } else if (String_startsWith(line + 1, "ead_bytes: ")) {
- lp->io_read_bytes = strtoull(line + 12, NULL, 10);
- lp->io_rate_read_bps = time_delta ? saturatingSub(lp->io_read_bytes, last_read) * /*ms to s*/1000. / time_delta : NAN;
- }
- break;
- case 'w':
- if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
- lp->io_wchar = strtoull(line + 7, NULL, 10);
- } else if (String_startsWith(line + 1, "rite_bytes: ")) {
- lp->io_write_bytes = strtoull(line + 13, NULL, 10);
- lp->io_rate_write_bps = time_delta ? saturatingSub(lp->io_write_bytes, last_write) * /*ms to s*/1000. / time_delta : NAN;
- }
- break;
- case 's':
- if (line[4] == 'r' && String_startsWith(line + 1, "yscr: ")) {
- lp->io_syscr = strtoull(line + 7, NULL, 10);
- } else if (String_startsWith(line + 1, "yscw: ")) {
- lp->io_syscw = strtoull(line + 7, NULL, 10);
- }
- break;
- case 'c':
- if (String_startsWith(line + 1, "ancelled_write_bytes: ")) {
- lp->io_cancelled_write_bytes = strtoull(line + 23, NULL, 10);
- }
+ case 'r':
+ if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
+ lp->io_rchar = strtoull(line + 7, NULL, 10);
+ } else if (String_startsWith(line + 1, "ead_bytes: ")) {
+ lp->io_read_bytes = strtoull(line + 12, NULL, 10);
+ lp->io_rate_read_bps = time_delta ? saturatingSub(lp->io_read_bytes, last_read) * /*ms to s*/1000. / time_delta : NAN;
+ }
+ break;
+ case 'w':
+ if (line[1] == 'c' && String_startsWith(line + 2, "har: ")) {
+ lp->io_wchar = strtoull(line + 7, NULL, 10);
+ } else if (String_startsWith(line + 1, "rite_bytes: ")) {
+ lp->io_write_bytes = strtoull(line + 13, NULL, 10);
+ lp->io_rate_write_bps = time_delta ? saturatingSub(lp->io_write_bytes, last_write) * /*ms to s*/1000. / time_delta : NAN;
+ }
+ break;
+ case 's':
+ if (line[4] == 'r' && String_startsWith(line + 1, "yscr: ")) {
+ lp->io_syscr = strtoull(line + 7, NULL, 10);
+ } else if (String_startsWith(line + 1, "yscw: ")) {
+ lp->io_syscw = strtoull(line + 7, NULL, 10);
+ }
+ break;
+ case 'c':
+ if (String_startsWith(line + 1, "ancelled_write_bytes: ")) {
+ lp->io_cancelled_write_bytes = strtoull(line + 23, NULL, 10);
+ }
}
}
@@ -807,18 +807,18 @@ static void LinuxProcessTable_readOpenVZData(LinuxProcess* process, openat_arg_t
*value_end = '\0';
switch (field) {
- case 1:
- foundEnvID = true;
- if (!String_eq(name_value_sep, process->ctid ? process->ctid : ""))
- free_and_xStrdup(&process->ctid, name_value_sep);
- break;
- case 2:
- foundVPid = true;
- process->vpid = strtoul(name_value_sep, NULL, 0);
- break;
- default:
- //Sanity Check: Should never reach here, or the implementation is missing something!
- assert(false && "OpenVZ handling: Unimplemented case for field handling reached.");
+ case 1:
+ foundEnvID = true;
+ if (!String_eq(name_value_sep, process->ctid ? process->ctid : ""))
+ free_and_xStrdup(&process->ctid, name_value_sep);
+ break;
+ case 2:
+ foundVPid = true;
+ process->vpid = strtoul(name_value_sep, NULL, 0);
+ break;
+ default:
+ //Sanity Check: Should never reach here, or the implementation is missing something!
+ assert(false && "OpenVZ handling: Unimplemented case for field handling reached.");
}
}
@@ -1457,7 +1457,7 @@ static bool LinuxProcessTable_recurseProcTree(LinuxProcessTable* this, openat_ar
bool prev = proc->usesDeletedLib;
if (!proc->isKernelThread && !proc->isUserlandThread &&
- ((ss->flags & PROCESS_FLAG_LINUX_LRS_FIX) || (settings->highlightDeletedExe && !proc->procExeDeleted && isOlderThan(proc, 10)))) {
+ ((ss->flags & PROCESS_FLAG_LINUX_LRS_FIX) || (settings->highlightDeletedExe && !proc->procExeDeleted && isOlderThan(proc, 10)))) {
// Check if we really should recalculate the M_LRS value for this process
uint64_t passedTimeInMs = host->realtimeMs - lp->last_mlrs_calctime;
@@ -1521,7 +1521,7 @@ static bool LinuxProcessTable_recurseProcTree(LinuxProcessTable* this, openat_ar
proc->percent_mem = proc->m_resident / (double)(host->totalMem) * 100.0;
Process_updateCPUFieldWidths(proc->percent_cpu);
- if (! LinuxProcessTable_updateUser(host, proc, procFd))
+ if (!LinuxProcessTable_updateUser(host, proc, procFd))
goto errorReadingProcess;
if (!LinuxProcessTable_readStatusFile(proc, procFd))
diff --git a/linux/Platform.c b/linux/Platform.c
index fbbedc6e..84eb8b1a 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -303,7 +303,7 @@ pid_t Platform_getMaxPid(void) {
}
double Platform_setCPUValues(Meter* this, unsigned int cpu) {
- const LinuxMachine* lhost = (const LinuxMachine *) this->host;
+ const LinuxMachine* lhost = (const LinuxMachine*) this->host;
const Settings* settings = this->host->settings;
const CPUData* cpuData = &(lhost->cpuData[cpu]);
double total = (double) ( cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod);
@@ -928,7 +928,7 @@ CommandLineStatus Platform_getLongOption(int opt, int argc, char** argv) {
case 160: {
const char* mode = optarg;
if (!mode && optind < argc && argv[optind] != NULL &&
- (argv[optind][0] != '\0' && argv[optind][0] != '-')) {
+ (argv[optind][0] != '\0' && argv[optind][0] != '-')) {
mode = argv[optind++];
}
diff --git a/linux/SystemdMeter.c b/linux/SystemdMeter.c
index a154d1b8..e13c6461 100644
--- a/linux/SystemdMeter.c
+++ b/linux/SystemdMeter.c
@@ -307,12 +307,12 @@ static void SystemdMeter_updateValues(Meter* this) {
static int zeroDigitColor(unsigned int value) {
switch (value) {
- case 0:
- return CRT_colors[METER_VALUE];
- case INVALID_VALUE:
- return CRT_colors[METER_VALUE_ERROR];
- default:
- return CRT_colors[METER_VALUE_NOTICE];
+ case 0:
+ return CRT_colors[METER_VALUE];
+ case INVALID_VALUE:
+ return CRT_colors[METER_VALUE_ERROR];
+ default:
+ return CRT_colors[METER_VALUE_NOTICE];
}
}

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