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
46233944
Commit
46233944
authored
Mar 07, 2016
by
Hisham Muhammad
Browse files
Merge pull request #435 from mmcco/freebsd
Improve error reporting on FreeBSD libkvm call
parents
63c55854
b886ecc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
freebsd/FreeBSDProcessList.c
View file @
46233944
...
@@ -14,7 +14,9 @@ in the source distribution for its full text.
...
@@ -14,7 +14,9 @@ in the source distribution for its full text.
#include <sys/types.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <sys/user.h>
#include <err.h>
#include <fcntl.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <string.h>
/*{
/*{
...
@@ -86,12 +88,12 @@ static int kernelFScale;
...
@@ -86,12 +88,12 @@ static int kernelFScale;
ProcessList
*
ProcessList_new
(
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
ProcessList
*
ProcessList_new
(
UsersTable
*
usersTable
,
Hashtable
*
pidWhiteList
,
uid_t
userId
)
{
size_t
len
;
char
errbuf
[
_POSIX2_LINE_MAX
];
FreeBSDProcessList
*
fpl
=
xCalloc
(
1
,
sizeof
(
FreeBSDProcessList
));
FreeBSDProcessList
*
fpl
=
xCalloc
(
1
,
sizeof
(
FreeBSDProcessList
));
ProcessList
*
pl
=
(
ProcessList
*
)
fpl
;
ProcessList
*
pl
=
(
ProcessList
*
)
fpl
;
ProcessList_init
(
pl
,
Class
(
FreeBSDProcess
),
usersTable
,
pidWhiteList
,
userId
);
ProcessList_init
(
pl
,
Class
(
FreeBSDProcess
),
usersTable
,
pidWhiteList
,
userId
);
size_t
len
;
// physical memory in system: hw.physmem
// physical memory in system: hw.physmem
// physical page size: hw.pagesize
// physical page size: hw.pagesize
// usable pagesize : vm.stats.vm.v_page_size
// usable pagesize : vm.stats.vm.v_page_size
...
@@ -178,8 +180,10 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
...
@@ -178,8 +180,10 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, ui
kernelFScale
=
2048
;
kernelFScale
=
2048
;
}
}
fpl
->
kd
=
kvm_open
(
NULL
,
"/dev/null"
,
NULL
,
0
,
NULL
);
fpl
->
kd
=
kvm_openfiles
(
NULL
,
"/dev/null"
,
NULL
,
0
,
errbuf
);
assert
(
fpl
->
kd
);
if
(
fpl
->
kd
==
NULL
)
{
errx
(
1
,
"kvm_open: %s"
,
errbuf
);
}
return
pl
;
return
pl
;
}
}
...
...
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