mirror of https://github.com/xzeldon/htop.git
Remove some trailing whitespace
This commit is contained in:
parent
9f1884c28f
commit
8673a84e5f
|
@ -52,7 +52,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
|
||||||
OpenBSDProcessList* fpl = calloc(1, sizeof(OpenBSDProcessList));
|
OpenBSDProcessList* fpl = calloc(1, sizeof(OpenBSDProcessList));
|
||||||
ProcessList* pl = (ProcessList*) fpl;
|
ProcessList* pl = (ProcessList*) fpl;
|
||||||
size_t size = sizeof(pl->cpuCount);
|
size_t size = sizeof(pl->cpuCount);
|
||||||
|
|
||||||
ProcessList_init(pl, Class(OpenBSDProcess), usersTable, pidWhiteList, userId);
|
ProcessList_init(pl, Class(OpenBSDProcess), usersTable, pidWhiteList, userId);
|
||||||
pl->cpuCount = 1; // default to 1 on sysctl() error
|
pl->cpuCount = 1; // default to 1 on sysctl() error
|
||||||
(void)sysctl(mib, 2, &pl->cpuCount, &size, NULL, 0);
|
(void)sysctl(mib, 2, &pl->cpuCount, &size, NULL, 0);
|
||||||
|
@ -66,7 +66,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
|
||||||
fpl->cpus[i].totalTime = 1;
|
fpl->cpus[i].totalTime = 1;
|
||||||
fpl->cpus[i].totalPeriod = 1;
|
fpl->cpus[i].totalPeriod = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pageSizeKb = PAGE_SIZE_KB;
|
pageSizeKb = PAGE_SIZE_KB;
|
||||||
|
|
||||||
// XXX: last arg should eventually be an errbuf
|
// XXX: last arg should eventually be an errbuf
|
||||||
|
@ -79,7 +79,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
|
||||||
void ProcessList_delete(ProcessList* this) {
|
void ProcessList_delete(ProcessList* this) {
|
||||||
const OpenBSDProcessList* fpl = (OpenBSDProcessList*) this;
|
const OpenBSDProcessList* fpl = (OpenBSDProcessList*) this;
|
||||||
if (fpl->kd) kvm_close(fpl->kd);
|
if (fpl->kd) kvm_close(fpl->kd);
|
||||||
|
|
||||||
ProcessList_done(this);
|
ProcessList_done(this);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const OpenBSDProcessList* fpl = (OpenBSDProcessList*) pl;
|
const OpenBSDProcessList* fpl = (OpenBSDProcessList*) pl;
|
||||||
|
|
||||||
size_t len = sizeof(pl->totalMem);
|
size_t len = sizeof(pl->totalMem);
|
||||||
sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0);
|
sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0);
|
||||||
pl->totalMem /= 1024;
|
pl->totalMem /= 1024;
|
||||||
|
@ -108,7 +108,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
pl->freeMem = pl->totalMem - pl->usedMem;
|
pl->freeMem = pl->totalMem - pl->usedMem;
|
||||||
sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(pl->cachedMem), &len, NULL, 0);
|
sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(pl->cachedMem), &len, NULL, 0);
|
||||||
pl->cachedMem *= pageSizeKb;
|
pl->cachedMem *= pageSizeKb;
|
||||||
|
|
||||||
struct kvm_swap swap[16];
|
struct kvm_swap swap[16];
|
||||||
int nswap = kvm_getswapinfo(fpl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
|
int nswap = kvm_getswapinfo(fpl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
|
||||||
pl->totalSwap = 0;
|
pl->totalSwap = 0;
|
||||||
|
@ -119,7 +119,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
}
|
}
|
||||||
pl->totalSwap *= pageSizeKb;
|
pl->totalSwap *= pageSizeKb;
|
||||||
pl->usedSwap *= pageSizeKb;
|
pl->usedSwap *= pageSizeKb;
|
||||||
|
|
||||||
pl->sharedMem = 0; // currently unused
|
pl->sharedMem = 0; // currently unused
|
||||||
pl->buffersMem = 0; // not exposed to userspace
|
pl->buffersMem = 0; // not exposed to userspace
|
||||||
*/
|
*/
|
||||||
|
@ -179,23 +179,23 @@ void ProcessList_goThroughEntries(ProcessList* this) {
|
||||||
OpenBSDProcess* fp;
|
OpenBSDProcess* fp;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
OpenBSDProcessList_scanMemoryInfo(this);
|
OpenBSDProcessList_scanMemoryInfo(this);
|
||||||
|
|
||||||
// use KERN_PROC_KTHREAD to also include kernel threads
|
// use KERN_PROC_KTHREAD to also include kernel threads
|
||||||
struct kinfo_proc* kprocs = kvm_getprocs(fpl->kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
|
struct kinfo_proc* kprocs = kvm_getprocs(fpl->kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
|
||||||
//struct kinfo_proc* kprocs = getprocs(KERN_PROC_ALL, 0, &count);
|
//struct kinfo_proc* kprocs = getprocs(KERN_PROC_ALL, 0, &count);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
kproc = &kprocs[i];
|
kproc = &kprocs[i];
|
||||||
|
|
||||||
preExisting = false;
|
preExisting = false;
|
||||||
proc = ProcessList_getProcess(this, kproc->p_pid, &preExisting, (Process_New) OpenBSDProcess_new);
|
proc = ProcessList_getProcess(this, kproc->p_pid, &preExisting, (Process_New) OpenBSDProcess_new);
|
||||||
fp = (OpenBSDProcess*) proc;
|
fp = (OpenBSDProcess*) proc;
|
||||||
|
|
||||||
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc))
|
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc))
|
||||||
|| (hideUserlandThreads && Process_isUserlandThread(proc)));
|
|| (hideUserlandThreads && Process_isUserlandThread(proc)));
|
||||||
|
|
||||||
if (!preExisting) {
|
if (!preExisting) {
|
||||||
proc->ppid = kproc->p_ppid;
|
proc->ppid = kproc->p_ppid;
|
||||||
proc->tpgid = kproc->p_tpgid;
|
proc->tpgid = kproc->p_tpgid;
|
||||||
|
@ -240,7 +240,7 @@ void ProcessList_goThroughEntries(ProcessList* this) {
|
||||||
if (Process_isKernelThread(proc)) {
|
if (Process_isKernelThread(proc)) {
|
||||||
this->kernelThreads++;
|
this->kernelThreads++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->totalTasks++;
|
this->totalTasks++;
|
||||||
// SRUN ('R') means runnable, not running
|
// SRUN ('R') means runnable, not running
|
||||||
if (proc->state == 'P') {
|
if (proc->state == 'P') {
|
||||||
|
|
|
@ -167,7 +167,7 @@ int Platform_getUptime() {
|
||||||
struct timeval bootTime, currTime;
|
struct timeval bootTime, currTime;
|
||||||
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
|
int mib[2] = { CTL_KERN, KERN_BOOTTIME };
|
||||||
size_t size = sizeof(bootTime);
|
size_t size = sizeof(bootTime);
|
||||||
|
|
||||||
int err = sysctl(mib, 2, &bootTime, &size, NULL, 0);
|
int err = sysctl(mib, 2, &bootTime, &size, NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -181,7 +181,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||||
struct loadavg loadAverage;
|
struct loadavg loadAverage;
|
||||||
int mib[2] = { CTL_VM, VM_LOADAVG };
|
int mib[2] = { CTL_VM, VM_LOADAVG };
|
||||||
size_t size = sizeof(loadAverage);
|
size_t size = sizeof(loadAverage);
|
||||||
|
|
||||||
int err = sysctl(mib, 2, &loadAverage, &size, NULL, 0);
|
int err = sysctl(mib, 2, &loadAverage, &size, NULL, 0);
|
||||||
if (err) {
|
if (err) {
|
||||||
*one = 0;
|
*one = 0;
|
||||||
|
|
Loading…
Reference in New Issue