Skip to content

run.c doesn't compile on OpenBSD #7

Open
@Veraellyunjie

Description

uname
OpenBSD
clang run.c -o run
run.c:36:5: error: use of undeclared identifier 'cpu_set_t'
    cpu_set_t cpu_set;
    ^
run.c:64:5: warning: implicit declaration of function 'CPU_ZERO' is invalid in C99 [-Wimplicit-function-declaration]
    CPU_ZERO(&cpu_set);
    ^
run.c:64:15: error: use of undeclared identifier 'cpu_set'; did you mean 'cgetset'?
    CPU_ZERO(&cpu_set);
              ^~~~~~~
              cgetset
/usr/include/stdlib.h:277:6: note: 'cgetset' declared here
int      cgetset(const char *);
         ^
run.c:65:5: warning: implicit declaration of function 'CPU_SET' is invalid in C99 [-Wimplicit-function-declaration]
    CPU_SET(core, &cpu_set);
    ^
run.c:65:20: error: use of undeclared identifier 'cpu_set'; did you mean 'cgetset'?
    CPU_SET(core, &cpu_set);
                   ^~~~~~~
                   cgetset
/usr/include/stdlib.h:277:6: note: 'cgetset' declared here
int      cgetset(const char *);
         ^
run.c:66:17: warning: implicit declaration of function 'sched_setaffinity' is invalid in C99 [-Wimplicit-function-declaration]
    if(unlikely(sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) == -1)) {
                ^
run.c:66:52: error: use of undeclared identifier 'cpu_set'
    if(unlikely(sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) == -1)) {
                                                   ^
run.c:66:63: error: use of undeclared identifier 'cpu_set'; did you mean 'cgetset'?
    if(unlikely(sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) == -1)) {
                                                              ^~~~~~~
                                                              cgetset
run.c:28:39: note: expanded from macro 'unlikely'
#define unlikely(x) __builtin_expect((x),0)
                                      ^
/usr/include/stdlib.h:277:6: note: 'cgetset' declared here
int      cgetset(const char *);
         ^
3 warnings and 5 errors generated.
egcc run.c -o run
run.c: In function 'main':
run.c:36:5: error: unknown type name 'cpu_set_t'
   36 |     cpu_set_t cpu_set;
      |     ^~~~~~~~~
run.c:64:5: warning: implicit declaration of function 'CPU_ZERO' [-Wimplicit-function-declaration]
   64 |     CPU_ZERO(&cpu_set);
      |     ^~~~~~~~
run.c:65:5: warning: implicit declaration of function 'CPU_SET'; did you mean 'L_SET'? [-Wimplicit-function-declaration]
   65 |     CPU_SET(core, &cpu_set);
      |     ^~~~~~~
      |     L_SET
run.c:66:17: warning: implicit declaration of function 'sched_setaffinity' [-Wimplicit-function-declaration]
   66 |     if(unlikely(sched_setaffinity(getpid(), sizeof(cpu_set), &cpu_set) == -1)) {
      |                 ^~~~~~~~~~~~~~~~~
run.c:28:39: note: in definition of macro 'unlikely'
   28 | #define unlikely(x) __builtin_expect((x),0)
      |                                       ^

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedThe bug is verified and can be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions