I want to implement the DEADLINE scheduling policy in C. I know that the function is implemented with Linux 3.14.10 , and I use Ubuntu 14.04 Linux #### 3.17.0-031700-lowlatency #201410060605 SMP PREEMPT , which should be fairly recent. I am developing a program using Eclipse (runs as sudo).
I defined _GNU_SOURCE and included sched.h and I still cannot use the SCHED_DEADLINE keyword to define struct sched_attr or use a function like sched_getattr .
#define _GNU_SOURCE #include <sched.h>
None of these keywords and functions are defined in my /usr/include/ folder, but I managed to find them in /usr/src/linux-headers-3.17.0-031700/include/ . I tried to include this folder in my project build options, but it seems to be creating a communication error.
I am not very used to C developpment (I am originally the creator of JS), so if someone can explain to me what I am doing wrong and how to fix it, it will be very nice.
Contents /usr/include/linux/sched.h
#ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H #define CSIGNAL 0x000000ff #define CLONE_VM 0x00000100 #define CLONE_FS 0x00000200 #define CLONE_FILES 0x00000400 #define CLONE_SIGHAND 0x00000800 #define CLONE_PTRACE 0x00002000 #define CLONE_VFORK 0x00004000 #define CLONE_PARENT 0x00008000 #define CLONE_THREAD 0x00010000 #define CLONE_NEWNS 0x00020000 #define CLONE_SYSVSEM 0x00040000 #define CLONE_SETTLS 0x00080000 #define CLONE_PARENT_SETTID 0x00100000 #define CLONE_CHILD_CLEARTID 0x00200000 #define CLONE_DETACHED 0x00400000 #define CLONE_UNTRACED 0x00800000 #define CLONE_CHILD_SETTID 0x01000000 #define CLONE_NEWUTS 0x04000000 #define CLONE_NEWIPC 0x08000000 #define CLONE_NEWUSER 0x10000000 #define CLONE_NEWPID 0x20000000 #define CLONE_NEWNET 0x40000000 #define CLONE_IO 0x80000000 #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 #define SCHED_IDLE 5 #define SCHED_RESET_ON_FORK 0x40000000 #endif
EDIT
The files I want are in the /usr/src/linux-headers-3.17.0-031700/include/ folder. Anyway, I tried to add a folder to my project using several methods. First use the -I flag gcc and next, using the C_INCLUDE_PATH environment C_INCLUDE_PATH .
In both cases, gcc looked for priority in the default locations and found the wrong <sched.h> file. I tried using the -nostdinc to suppress default locations, but this is even worse ... I get a lot of errors.
source share