diff options
-rw-r--r-- | cpus.h | 16 | ||||
-rw-r--r-- | ct_server.c | 1 | ||||
-rw-r--r-- | ifpps.c | 1 | ||||
-rw-r--r-- | trafgen.c | 1 | ||||
-rw-r--r-- | xutils.c | 10 | ||||
-rw-r--r-- | xutils.h | 2 |
6 files changed, 19 insertions, 12 deletions
@@ -0,0 +1,16 @@ +#ifndef CPUS_H +#define CPUS_H + +#include <unistd.h> + +static inline int get_number_cpus(void) +{ + return sysconf(_SC_NPROCESSORS_CONF); +} + +static inline int get_number_cpus_online(void) +{ + return sysconf(_SC_NPROCESSORS_ONLN); +} + +#endif /* CPUS_H */ diff --git a/ct_server.c b/ct_server.c index 045472e..7c23b52 100644 --- a/ct_server.c +++ b/ct_server.c @@ -34,6 +34,7 @@ #include "xmalloc.h" #include "curvetun.h" #include "curve.h" +#include "cpus.h" #include "built_in.h" #include "ct_usermgmt.h" #include "cpusched.h" @@ -21,6 +21,7 @@ #include "xmalloc.h" #include "xutils.h" #include "xio.h" +#include "cpus.h" #include "built_in.h" struct wifi_stat { @@ -35,6 +35,7 @@ #include "xmalloc.h" #include "die.h" #include "str.h" +#include "cpus.h" #include "lockme.h" #include "mac80211.h" #include "xutils.h" @@ -718,16 +718,6 @@ int get_default_sched_prio(void) return sched_get_priority_max(get_default_sched_policy()); } -int get_number_cpus(void) -{ - return sysconf(_SC_NPROCESSORS_CONF); -} - -int get_number_cpus_online(void) -{ - return sysconf(_SC_NPROCESSORS_ONLN); -} - int get_default_proc_prio(void) { return -20; @@ -69,8 +69,6 @@ extern int set_proc_prio(int prio); extern int set_sched_status(int policy, int priority); extern int get_default_sched_policy(void); extern int get_default_sched_prio(void); -extern int get_number_cpus(void); -extern int get_number_cpus_online(void); extern int get_default_proc_prio(void); extern void set_system_socket_memory(int *vals, size_t len); extern void reset_system_socket_memory(int *vals, size_t len); |