1SCHED_SETPARAM(2) Linux Programmer's Manual SCHED_SETPARAM(2)
2
3
4
6 sched_setparam, sched_getparam - set and get scheduling parameters
7
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
22 sched_setparam() sets the scheduling parameters associated with the
23 scheduling policy for the process identified by pid. If pid is zero,
24 then the parameters of the calling process are set. The interpretation
25 of the argument param depends on the scheduling policy of the process
26 identified by pid. See sched(7) for a description of the scheduling
27 policies supported under Linux.
28
29 sched_getparam() retrieves the scheduling parameters for the process
30 identified by pid. If pid is zero, then the parameters of the calling
31 process 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
44 On success, sched_setparam() and sched_getparam() return 0. On error,
45 -1 is returned, and errno is set appropriately.
46
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 calling process does not have appropriate
54 privileges (Linux: does not have the CAP_SYS_NICE capability).
55
56 ESRCH The process whose ID is pid could not be found.
57
59 POSIX.1-2001, POSIX.1-2008.
60
62 Scheduling parameters are in fact per-thread attributes on Linux; see
63 sched(7).
64
66 getpriority(2), nice(2), sched_get_priority_max(2),
67 sched_get_priority_min(2), sched_getaffinity(2), sched_getscheduler(2),
68 sched_setaffinity(2), sched_setattr(2), sched_setscheduler(2),
69 setpriority(2), capabilities(7), sched(7)
70
72 This page is part of release 4.15 of the Linux man-pages project. A
73 description of the project, information about reporting bugs, and the
74 latest version of this page, can be found at
75 https://www.kernel.org/doc/man-pages/.
76
77
78
79Linux 2017-09-15 SCHED_SETPARAM(2)