#define SCHED_OTHER 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_IDLE 5 struct sched_param { int32_t sched_priority; }; int sched_getscheduler(pid_t pid, struct sched_param *param); int sched_setscheduler(pid_t pid, int policy, struct sched_param *param);
This syscalls get and set scheduler details for the passed process. pid
can be either a PID or 0 for the caller. param stands for the
scheduler-specific parameters of the passed PID. For both calls param
can be passed NULL for the OS to not modify or read it.
param’s priority is only used for the real time policies, and is
delimited by the values returned at see get_min/max_priority.
sched_getscheduler returns the scheduler policy or -1 on failure,
sched_setscheduler returns 0 on success or -1 on failure.
Both operations return the following errno on failure:
EINVALpid is not valid.
EFAULTA non-NULL pointer points to not valid memory.