1SCHED_SETPARAM(2)          Linux Programmer's Manual         SCHED_SETPARAM(2)
2
3
4

NAME

6       sched_setparam, sched_getparam - set and get scheduling parameters
7

SYNOPSIS

9       #include <sched.h>
10
11       int sched_setparam(pid_t pid, const struct sched_param *param);
12       int sched_getparam(pid_t pid, struct sched_param *param);
13
14       struct sched_param {
15           ...
16           int sched_priority;
17           ...
18       };
19

DESCRIPTION

21       sched_setparam()  sets  the  scheduling  parameters associated with the
22       scheduling policy for the thread whose thread ID is specified  in  pid.
23       If pid is zero, then the parameters of the calling thread are set.  The
24       interpretation of the argument param depends on the  scheduling  policy
25       of the thread identified by pid.  See sched(7) for a description of the
26       scheduling policies supported under Linux.
27
28       sched_getparam() retrieves the scheduling  parameters  for  the  thread
29       identified  by pid.  If pid is zero, then the parameters of the calling
30       thread are retrieved.
31
32       sched_setparam() checks the validity of param for the scheduling policy
33       of  the  thread.   The  value param->sched_priority must lie within the
34       range given by sched_get_priority_min(2) and sched_get_priority_max(2).
35
36       For a discussion of the  privileges  and  resource  limits  related  to
37       scheduling priority and policy, see sched(7).
38
39       POSIX systems on which sched_setparam() and sched_getparam() are avail‐
40       able define _POSIX_PRIORITY_SCHEDULING in <unistd.h>.
41

RETURN VALUE

43       On success, sched_setparam() and sched_getparam() return 0.  On  error,
44       -1 is returned, and errno is set to indicate the error.
45

ERRORS

47       EINVAL Invalid arguments: param is NULL or pid is negative
48
49       EINVAL (sched_setparam())  The  argument  param does not make sense for
50              the current scheduling policy.
51
52       EPERM  (sched_setparam()) The caller does not have  appropriate  privi‐
53              leges (Linux: does not have the CAP_SYS_NICE capability).
54
55       ESRCH  The thread whose ID is pid could not be found.
56

CONFORMING TO

58       POSIX.1-2001, POSIX.1-2008.
59

SEE ALSO

61       getpriority(2), gettid(2), nice(2), sched_get_priority_max(2),
62       sched_get_priority_min(2), sched_getaffinity(2), sched_getscheduler(2),
63       sched_setaffinity(2), sched_setattr(2), sched_setscheduler(2),
64       setpriority(2), capabilities(7), sched(7)
65

COLOPHON

67       This page is part of release 5.12 of the Linux man-pages project.  A
68       description of the project, information about reporting bugs, and the
69       latest version of this page, can be found at
70       https://www.kernel.org/doc/man-pages/.
71
72
73
74Linux                             2021-03-22                 SCHED_SETPARAM(2)
Impressum