summaryrefslogtreecommitdiffstats
path: root/openbsd
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 /openbsd
parentb23f8235e28472c410dcb00893e0e3d403892673 (diff)
Spacing around operators
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/Battery.c2
-rw-r--r--openbsd/OpenBSDProcessList.c12
-rw-r--r--openbsd/OpenBSDProcessList.h2
-rw-r--r--openbsd/Platform.c26
-rw-r--r--openbsd/Platform.h8
5 files changed, 25 insertions, 25 deletions
diff --git a/openbsd/Battery.c b/openbsd/Battery.c
index 232b1255..b72253e0 100644
--- a/openbsd/Battery.c
+++ b/openbsd/Battery.c
@@ -53,7 +53,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
mib[4] = 3;
if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
double charge = s.value;
- *level = 100*(charge / last_full_capacity);
+ *level = 100 * (charge / last_full_capacity);
if (charge >= last_full_capacity) {
*level = 100;
}
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index 86e2dca6..bfac535d 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -56,7 +56,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
}
for (i = 0; i <= pl->cpuCount; i++) {
- CPUData *d = opl->cpus + i;
+ CPUData* d = opl->cpus + i;
d->totalTime = 1;
d->totalPeriod = 1;
}
@@ -134,7 +134,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
*/
}
-char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
+char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
char *s, **arg;
size_t len = 0, n;
int i;
@@ -163,7 +163,7 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
n = strlcat(s, arg[i], len);
if (i == 0) {
/* TODO: rename all basenameEnd to basenameLen, make size_t */
- *basenameEnd = MINIMUM(n, len-1);
+ *basenameEnd = MINIMUM(n, len - 1);
}
/* the trailing space should get truncated anyway */
strlcat(s, " ", len);
@@ -175,9 +175,9 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
/*
* Taken from OpenBSD's ps(1).
*/
-static double getpcpu(const struct kinfo_proc *kp) {
+static double getpcpu(const struct kinfo_proc* kp) {
if (fscale == 0)
- return (0.0);
+ return 0.0;
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
@@ -232,7 +232,7 @@ static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
proc->m_size = kproc->p_vm_dsize;
proc->m_resident = kproc->p_vm_rssize;
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(this->super.totalMem) * 100.0;
- proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount*100.0);
+ proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount * 100.0);
//proc->nlwp = kproc->p_numthreads;
//proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 10);
proc->nice = kproc->p_nice - 20;
diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessList.h
index 7ee48c63..1b40faf1 100644
--- a/openbsd/OpenBSDProcessList.h
+++ b/openbsd/OpenBSDProcessList.h
@@ -43,7 +43,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
void ProcessList_delete(ProcessList* this);
-char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
+char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index d9737c39..21a33d1e 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -162,7 +162,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
const CPUData* cpuData = &(pl->cpus[cpu]);
double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod;
double totalPercent;
- double *v = this->values;
+ double* v = this->values;
v[CPU_METER_NICE] = cpuData->nicePeriod / total * 100.0;
v[CPU_METER_NORMAL] = cpuData->userPeriod / total * 100.0;
@@ -175,11 +175,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
v[CPU_METER_IOWAIT] = 0.0;
v[CPU_METER_FREQUENCY] = NAN;
this->curItems = 8;
- totalPercent = v[0]+v[1]+v[2]+v[3];
+ totalPercent = v[0] + v[1] + v[2] + v[3];
} else {
v[2] = cpuData->sysAllPeriod / total * 100.0;
v[3] = 0.0; // No steal nor guest on OpenBSD
- totalPercent = v[0]+v[1]+v[2];
+ totalPercent = v[0] + v[1] + v[2];
this->curItems = 4;
}
@@ -208,7 +208,7 @@ void Platform_setMemoryValues(Meter* this) {
*/
void Platform_setSwapValues(Meter* this) {
const ProcessList* pl = this->pl;
- struct swapent *swdev;
+ struct swapent* swdev;
unsigned long long int total, used;
int nswap, rnswap, i;
nswap = swapctl(SWAP_NSWAP, 0, 0);
@@ -243,11 +243,11 @@ void Platform_setSwapValues(Meter* this) {
char* Platform_getProcessEnv(pid_t pid) {
char errbuf[_POSIX2_LINE_MAX];
- char *env;
- char **ptr;
+ char* env;
+ char** ptr;
int count;
- kvm_t *kt;
- struct kinfo_proc *kproc;
+ kvm_t* kt;
+ struct kinfo_proc* kproc;
size_t capacity = 4096, size = 0;
if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
@@ -265,7 +265,7 @@ char* Platform_getProcessEnv(pid_t pid) {
}
env = xMalloc(capacity);
- for (char **p = ptr; *p; p++) {
+ for (char** p = ptr; *p; p++) {
size_t len = strlen(*p) + 1;
if (size + len > capacity) {
@@ -294,10 +294,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/openbsd/Platform.h b/openbsd/Platform.h
index 8cb5bdf3..7e3261a9 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -44,9 +44,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

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