aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAngelo Marletta <angelo.marletta@gmail.com>2012-06-08 12:24:27 +0200
committerAngelo Marletta <angelo.marletta@gmail.com>2012-06-08 12:24:27 +0200
commitfe6c77c340d7c83af7aea47d87f84d562c3da07a (patch)
treef85eb6bf0a3d753185f29012576855185cc01134 /src
parent10c2915dd464de44047f182ecae9c8b34e24e772 (diff)
downloadcpulimit-fe6c77c340d7c83af7aea47d87f84d562c3da07a.tar.gz
freebsd iterator works for non-privileged user
Diffstat (limited to 'src')
-rw-r--r--src/process_iterator.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/process_iterator.c b/src/process_iterator.c
index fd35952..f0cee92 100644
--- a/src/process_iterator.c
+++ b/src/process_iterator.c
@@ -84,11 +84,13 @@ int close_process_iterator(struct process_iterator *it) {
#include <sys/sysctl.h>
#include <sys/user.h>
+#include <fcntl.h>
+#include <paths.h>
int init_process_iterator(struct process_iterator *it) {
char errbuf[_POSIX2_LINE_MAX];
/* Open the kvm interface, get a descriptor */
- if ((it->kd = kvm_open(NULL, NULL, NULL, 0, errbuf)) == NULL) {
+ if ((it->kd = kvm_openfiles(NULL, _PATH_DEVNULL, NULL, O_RDONLY, errbuf)) == NULL) {
/* fprintf(stderr, "kvm_open: %s\n", errbuf); */
fprintf(stderr, "kvm_open: %s", errbuf);
return -1;
Un proyecto texto-plano.xyz