mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
|
@ -8,13 +8,14 @@
|
|||
|
||||
#if defined(__linux__)
|
||||
|
||||
#if !defined(_GNU_SOURCE)
|
||||
#if ! defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
bool set_affinity(int core_number)
|
||||
{
|
||||
cpu_set_t cpus;
|
||||
|
@ -23,35 +24,36 @@ bool set_affinity(int core_number)
|
|||
auto res = sched_setaffinity(0, sizeof(cpus), &cpus);
|
||||
return res == 0;
|
||||
}
|
||||
} // namespace zeek
|
||||
} // namespace zeek
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpuset.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
bool set_affinity(int core_number)
|
||||
{
|
||||
cpuset_t cpus;
|
||||
CPU_ZERO(&cpus);
|
||||
CPU_SET(core_number, &cpus);
|
||||
auto res = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
|
||||
sizeof(cpus), &cpus);
|
||||
auto res = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpus), &cpus);
|
||||
return res == 0;
|
||||
}
|
||||
} // namespace zeek
|
||||
} // namespace zeek
|
||||
|
||||
#else
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
bool set_affinity(int core_number)
|
||||
{
|
||||
errno = ENOTSUP;
|
||||
return false;
|
||||
}
|
||||
} // namespace zeek
|
||||
} // namespace zeek
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue