Results 1 to 2 of 2

Thread: Missing C functions getcpu() and sched_getcpu() (Deprecated?)

  1. #1

    Question Missing C functions getcpu() and sched_getcpu() (Deprecated?)

    Hi,

    Are the C functions sched_getcpu() and getcpu() deprecated in Leap 15.1?
    Because I can't find them on my system. But the man-pages exists for these functions.

    Always get the following compiler warning:

    Code:
    $ gcc -o test main.c
    main.c: In function ‘main’:
    main.c:9:33: warning: implicit declaration of function ‘sched_getcpu’; did you mean ‘sched_getparam’? [-Wimplicit-function-declaration]
         printf("CPU: %d\n", sched_getcpu());
                                     ^~~~~~~~~~~~
                                     sched_getparam
    $
    Here the code:
    Code:
    #include <stdio.h>
    #include <sched.h>
    
    int main(int argc, char *argv[])
    {
        printf("CPU: %d\n", sched_getcpu());
    }

  2. #2
    Join Date
    Sep 2012
    Posts
    5,713

    Default Re: Missing C functions getcpu() and sched_getcpu() (Deprecated?)

    As is quite clearly documented in sched_getcpu man page, you need _GNU_SOURCE macro to enable its definition.

    P.S. and how is this question related to Install/Boot/Login?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •