sched_setscheduler 2. Syntax 3. Param 4. Return Value 5. Remark 6. Example 7. Issue

Set scheduling policy and parameters (REALTIME).

The sched_setscheduler() function shall set the scheduling policy and scheduling parameters of the pid process to policy and param. The value of the sched_param::sched_priority member shall be any integer within the inclusive priority range for policy.

2. Syntax

1
int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param);

3. Param

pid

Process pid.

If pid exists, and if the calling process has permission, the scheduling policy and scheduling parameters shall be set for pid process.

If pid is zero, the scheduling policy and scheduling parameters shall be set for the calling process.

policy

The possible values for the policy are defined in the <sched.h> header.

param

sched_param structure.

4. Return Value

Upon successful, return the former scheduling policy of pid process; otherwise, the policy and scheduling parameters shall remain unchanged, return -1, and set errno to indicate the error.

5. Remark

-

  • If the value of pid is negative, the behavior of the sched_setscheduler() function is unspecified.

6. Example

7. Issue