#include <unistd.h>
#define _GNU_SOURCE
#include <sched.h>
#define number_of_cores() sysconf(_SC_NPROCESSORS_ONLN)
int lock_to_core(int core)
{
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(core, &set);
return sched_setaffinity(0, sizeof(cpu_set_t), &set);
} clang locktest.c
/tmp/locktest-997347.o: In function `lock_to_core':
locktest.c:(.text+0x7fb): undefined reference to `CPU_ZERO'
locktest.c:(.text+0x812): undefined reference to `CPU_SET'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
root@Csabi:~# #include <unistd.h>
#define __USE_GNU
#include <sched.h>
#define number_of_cores() sysconf(_SC_NPROCESSORS_ONLN)
int lock_to_core(int core)
{
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(core, &set);
return sched_setaffinity(0, sizeof(cpu_set_t), &set);
} clang locktest.c
In file included from locktest.c:1:
In file included from /usr/include/cpcsdk/sdk/cusleep.c:5:
In file included from /usr/include/cpcsdk/sdk/cputune.c:14:
In file included from /usr/include/cpcsdk/sdk/linux/cputune.c:9:
/usr/include/stdio.h:314:6: error: unknown type name '_IO_cookie_io_functions_t'
_IO_cookie_io_functions_t __io_funcs) __THROW __wur;
^
1 error generated.
root@Csabi:~# #include <unistd.h>
#define __USE_GNU
#include <sched.h>
#undef __USE_GNU
#define number_of_cores() sysconf(_SC_NPROCESSORS_ONLN)
int lock_to_core(int core)
{
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(core, &set);
return sched_setaffinity(0, sizeof(cpu_set_t), &set);
} root@Csabi:~# clang locktest.c
root@Csabi:~# Kurwa anyját a GNU-nak... |