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