Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
8673a84e
Commit
8673a84e
authored
Oct 13, 2015
by
Michael McConville
Browse files
Remove some trailing whitespace
parent
9f1884c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
openbsd/OpenBSDProcessList.c
View file @
8673a84e
...
...
@@ -52,7 +52,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
OpenBSDProcessList
*
fpl
=
calloc
(
1
,
sizeof
(
OpenBSDProcessList
));
ProcessList
*
pl
=
(
ProcessList
*
)
fpl
;
size_t
size
=
sizeof
(
pl
->
cpuCount
);
ProcessList_init
(
pl
,
Class
(
OpenBSDProcess
),
usersTable
,
pidWhiteList
,
userId
);
pl
->
cpuCount
=
1
;
// default to 1 on sysctl() error
(
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
].
totalPeriod
=
1
;
}
pageSizeKb
=
PAGE_SIZE_KB
;
// 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
)
{
const
OpenBSDProcessList
*
fpl
=
(
OpenBSDProcessList
*
)
this
;
if
(
fpl
->
kd
)
kvm_close
(
fpl
->
kd
);
ProcessList_done
(
this
);
free
(
this
);
}
...
...
@@ -99,7 +99,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
/*
const OpenBSDProcessList* fpl = (OpenBSDProcessList*) pl;
size_t len = sizeof(pl->totalMem);
sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0);
pl->totalMem /= 1024;
...
...
@@ -108,7 +108,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
pl->freeMem = pl->totalMem - pl->usedMem;
sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(pl->cachedMem), &len, NULL, 0);
pl->cachedMem *= pageSizeKb;
struct kvm_swap swap[16];
int nswap = kvm_getswapinfo(fpl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
pl->totalSwap = 0;
...
...
@@ -119,7 +119,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
}
pl->totalSwap *= pageSizeKb;
pl->usedSwap *= pageSizeKb;
pl->sharedMem = 0; // currently unused
pl->buffersMem = 0; // not exposed to userspace
*/
...
...
@@ -179,23 +179,23 @@ void ProcessList_goThroughEntries(ProcessList* this) {
OpenBSDProcess
*
fp
;
int
count
=
0
;
int
i
;
OpenBSDProcessList_scanMemoryInfo
(
this
);
// 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 = getprocs(KERN_PROC_ALL, 0, &count);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
kproc
=
&
kprocs
[
i
];
preExisting
=
false
;
proc
=
ProcessList_getProcess
(
this
,
kproc
->
p_pid
,
&
preExisting
,
(
Process_New
)
OpenBSDProcess_new
);
fp
=
(
OpenBSDProcess
*
)
proc
;
proc
->
show
=
!
((
hideKernelThreads
&&
Process_isKernelThread
(
proc
))
||
(
hideUserlandThreads
&&
Process_isUserlandThread
(
proc
)));
if
(
!
preExisting
)
{
proc
->
ppid
=
kproc
->
p_ppid
;
proc
->
tpgid
=
kproc
->
p_tpgid
;
...
...
@@ -240,7 +240,7 @@ void ProcessList_goThroughEntries(ProcessList* this) {
if
(
Process_isKernelThread
(
proc
))
{
this
->
kernelThreads
++
;
}
this
->
totalTasks
++
;
// SRUN ('R') means runnable, not running
if
(
proc
->
state
==
'P'
)
{
...
...
openbsd/Platform.c
View file @
8673a84e
...
...
@@ -167,7 +167,7 @@ int Platform_getUptime() {
struct
timeval
bootTime
,
currTime
;
int
mib
[
2
]
=
{
CTL_KERN
,
KERN_BOOTTIME
};
size_t
size
=
sizeof
(
bootTime
);
int
err
=
sysctl
(
mib
,
2
,
&
bootTime
,
&
size
,
NULL
,
0
);
if
(
err
)
{
return
-
1
;
...
...
@@ -181,7 +181,7 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
struct
loadavg
loadAverage
;
int
mib
[
2
]
=
{
CTL_VM
,
VM_LOADAVG
};
size_t
size
=
sizeof
(
loadAverage
);
int
err
=
sysctl
(
mib
,
2
,
&
loadAverage
,
&
size
,
NULL
,
0
);
if
(
err
)
{
*
one
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment