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
13       int sched_getparam(pid_t pid, struct sched_param *param);
14
15       struct sched_param {
16           ...
17           int sched_priority;
18           ...
19       };
20

DESCRIPTION

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

RETURN VALUE

44       On success, sched_setparam() and sched_getparam() return 0.  On  error,
45       -1 is returned, and errno is set appropriately.
46

ERRORS

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

CONFORMING TO

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

SEE ALSO

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

COLOPHON

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