mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The one place where we deviate is header include order since Zeek depends on headers being included in a certain order.
This commit is contained in:
parent
7b8e7ed72c
commit
f5a76c1aed
786 changed files with 131714 additions and 153609 deletions
|
@ -14,17 +14,15 @@
|
|||
|
||||
#include <sched.h>
|
||||
|
||||
namespace zeek
|
||||
{
|
||||
bool set_affinity(int core_number)
|
||||
{
|
||||
cpu_set_t cpus;
|
||||
CPU_ZERO(&cpus);
|
||||
CPU_SET(core_number, &cpus);
|
||||
auto res = sched_setaffinity(0, sizeof(cpus), &cpus);
|
||||
return res == 0;
|
||||
}
|
||||
} // namespace zeek
|
||||
namespace zeek {
|
||||
bool set_affinity(int core_number) {
|
||||
cpu_set_t cpus;
|
||||
CPU_ZERO(&cpus);
|
||||
CPU_SET(core_number, &cpus);
|
||||
auto res = sched_setaffinity(0, sizeof(cpus), &cpus);
|
||||
return res == 0;
|
||||
}
|
||||
} // namespace zeek
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
|
||||
|
@ -33,29 +31,25 @@ bool set_affinity(int core_number)
|
|||
#include <sys/cpuset.h>
|
||||
// clang-format on
|
||||
|
||||
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);
|
||||
return res == 0;
|
||||
}
|
||||
} // 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);
|
||||
return res == 0;
|
||||
}
|
||||
} // namespace zeek
|
||||
|
||||
#else
|
||||
|
||||
#include <cerrno>
|
||||
|
||||
namespace zeek
|
||||
{
|
||||
bool set_affinity(int core_number)
|
||||
{
|
||||
errno = ENOTSUP;
|
||||
return false;
|
||||
}
|
||||
} // namespace zeek
|
||||
namespace zeek {
|
||||
bool set_affinity(int core_number) {
|
||||
errno = ENOTSUP;
|
||||
return false;
|
||||
}
|
||||
} // namespace zeek
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue