1SCHED_SETPARAM(3P) POSIX Programmer's Manual SCHED_SETPARAM(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 sched_setparam — set scheduling parameters (REALTIME)
13
15 #include <sched.h>
16
17 int sched_setparam(pid_t pid, const struct sched_param *param);
18
20 The sched_setparam() function shall set the scheduling parameters of
21 the process specified by pid to the values specified by the sched_param
22 structure pointed to by param. The value of the sched_priority member
23 in the sched_param structure shall be any integer within the inclusive
24 priority range for the current scheduling policy of the process speci‐
25 fied by pid. Higher numerical values for the priority represent higher
26 priorities. If the value of pid is negative, the behavior of the
27 sched_setparam() function is unspecified.
28
29 If a process specified by pid exists, and if the calling process has
30 permission, the scheduling parameters shall be set for the process
31 whose process ID is equal to pid.
32
33 If pid is zero, the scheduling parameters shall be set for the calling
34 process.
35
36 The conditions under which one process has permission to change the
37 scheduling parameters of another process are implementation-defined.
38
39 Implementations may require the requesting process to have appropriate
40 privileges to set its own scheduling parameters or those of another
41 process.
42
43 See Scheduling Policies for a description on how this function affects
44 the scheduling of the threads within the target process.
45
46 If the current scheduling policy for the target process is not
47 SCHED_FIFO, SCHED_RR, or SCHED_SPORADIC, the result is implementation-
48 defined; this case includes the SCHED_OTHER policy.
49
50 The specified sched_ss_repl_period shall be greater than or equal to
51 the specified sched_ss_init_budget for the function to succeed; if it
52 is not, then the function shall fail.
53
54 The value of sched_ss_max_repl shall be within the inclusive range
55 [1,{SS_REPL_MAX}] for the function to succeed; if not, the function
56 shall fail. It is unspecified whether the sched_ss_repl_period and
57 sched_ss_init_budget values are stored as provided by this function or
58 are rounded to align with the resolution of the clock being used.
59
60 This function is not atomic with respect to other threads in the
61 process. Threads may continue to execute while this function call is in
62 the process of changing the scheduling policy for the underlying ker‐
63 nel-scheduled entities used by the process contention scope threads.
64
66 If successful, the sched_setparam() function shall return zero.
67
68 If the call to sched_setparam() is unsuccessful, the priority shall
69 remain unchanged, and the function shall return a value of -1 and set
70 errno to indicate the error.
71
73 The sched_setparam() function shall fail if:
74
75 EINVAL One or more of the requested scheduling parameters is outside
76 the range defined for the scheduling policy of the specified
77 pid.
78
79 EPERM The requesting process does not have permission to set the
80 scheduling parameters for the specified process, or does not
81 have appropriate privileges to invoke sched_setparam().
82
83 ESRCH No process can be found corresponding to that specified by pid.
84
85 The following sections are informative.
86
88 None.
89
91 None.
92
94 None.
95
97 None.
98
100 Scheduling Policies, sched_getparam(), sched_getscheduler(),
101 sched_setscheduler()
102
103 The Base Definitions volume of POSIX.1‐2017, <sched.h>
104
106 Portions of this text are reprinted and reproduced in electronic form
107 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
108 table Operating System Interface (POSIX), The Open Group Base Specifi‐
109 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
110 Electrical and Electronics Engineers, Inc and The Open Group. In the
111 event of any discrepancy between this version and the original IEEE and
112 The Open Group Standard, the original IEEE and The Open Group Standard
113 is the referee document. The original Standard can be obtained online
114 at http://www.opengroup.org/unix/online.html .
115
116 Any typographical or formatting errors that appear in this page are
117 most likely to have been introduced during the conversion of the source
118 files to man page format. To report such errors, see https://www.ker‐
119 nel.org/doc/man-pages/reporting_bugs.html .
120
121
122
123IEEE/The Open Group 2017 SCHED_SETPARAM(3P)