ioops: Constify `name' parameter to tun_open_or_die()
[netsniff-ng.git] / cpus.h
blob062672677d73b72319e93f546a8c70f3899c7ad4
1 #ifndef CPUS_H
2 #define CPUS_H
4 #include <unistd.h>
5 #include "built_in.h"
6 #include "die.h"
8 static inline unsigned int get_number_cpus(void)
10 int ret = sysconf(_SC_NPROCESSORS_CONF);
12 if (unlikely(ret <= 0))
13 panic("get_number_cpus error!\n");
15 return ret;
18 static inline unsigned int get_number_cpus_online(void)
20 int ret = sysconf(_SC_NPROCESSORS_ONLN);
22 if (unlikely(ret <= 0))
23 panic("get_number_cpus_online error!\n");
25 return ret;
28 #endif /* CPUS_H */