aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngelo Marletta <angelo.marletta@gmail.com>2013-05-24 12:19:02 -0700
committerAngelo Marletta <angelo.marletta@gmail.com>2013-05-24 12:19:02 -0700
commit82fa2cb97759fa32b71b2c67cae71bd5a2ce737f (patch)
tree9dc211ac8439d72510d9b9a8eb3bd657499ddf55
parent794336e939f7562d03a24c52ab650d8b6b960e99 (diff)
parentd03a935c09c29c2af98d2dc9c33937de2c83862a (diff)
downloadcpulimit-82fa2cb97759fa32b71b2c67cae71bd5a2ce737f.tar.gz
Merge pull request #24 from thinkingpotato/develop
[Related to #21] cpulimit doesn't handle multi core systems.
-rw-r--r--src/cpulimit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cpulimit.c b/src/cpulimit.c
index b031441..9b25b87 100644
--- a/src/cpulimit.c
+++ b/src/cpulimit.c
@@ -46,6 +46,10 @@
#include "process_group.h"
#include "list.h"
+#ifdef HAVE_SYS_SYSINFO_H
+#include <sys/sysinfo.h>
+#endif
+
#ifdef __APPLE__
#include "memrchr.c"
#endif
@@ -150,6 +154,8 @@ static int get_ncpu() {
int mib[2] = {CTL_HW, HW_NCPU};
size_t len = sizeof(ncpu);
sysctl(mib, 2, &ncpu, &len, NULL, 0);
+#elif defined _GNU_SOURCE
+ ncpu = get_nprocs();
#endif
return ncpu;
}
Un proyecto texto-plano.xyz