Add the following lines at the top of you source file
#define _GNU_SOURCE
#include <linux/sched.h> /* or #include <sched.h> */
_GNU_SOURCE
is a Feature test macro.
Feature test macros allow the programmer to control the definitions that are exposed by system header files when a program is compiled. In order to be effective, a feature test macro must be defined before including any header files. This can be done either in the compilation command (cc -DMACRO=value
) or by #define
-ing the macro within the source code before #include
-ing any headers.