1SCHED_SETSCHEDULER(3P)     POSIX Programmer's Manual    SCHED_SETSCHEDULER(3P)
2
3
4

PROLOG

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

NAME

12       sched_setscheduler — set scheduling policy and parameters (REALTIME)
13

SYNOPSIS

15       #include <sched.h>
16
17       int sched_setscheduler(pid_t pid, int policy,
18           const struct sched_param *param);
19

DESCRIPTION

21       The sched_setscheduler() function shall set the scheduling  policy  and
22       scheduling parameters of the process specified by pid to policy and the
23       parameters specified in the sched_param structure pointed to by  param,
24       respectively. The value of the sched_priority member in the sched_param
25       structure shall be any integer within the inclusive priority range  for
26       the scheduling policy specified by policy.  If the value of pid is neg‐
27       ative, the behavior of the sched_setscheduler()  function  is  unspeci‐
28       fied.
29
30       The  possible  values  for  the  policy  parameter  are  defined in the
31       <sched.h> header.
32
33       If a process specified by pid exists, and if the  calling  process  has
34       permission,  the  scheduling  policy and scheduling parameters shall be
35       set for the process whose process ID is equal to pid.
36
37       If pid is zero, the scheduling policy and scheduling  parameters  shall
38       be set for the calling process.
39
40       The  conditions  under  which one process has appropriate privileges to
41       change the scheduling parameters of another process are implementation-
42       defined.
43
44       Implementations may require that the requesting process have permission
45       to set its own scheduling  parameters  or  those  of  another  process.
46       Additionally,  implementation-defined  restrictions may apply as to the
47       appropriate privileges required to set the  scheduling  policy  of  the
48       process,  or  the scheduling policy of another process, to a particular
49       value.
50
51       The sched_setscheduler() function shall be considered successful if  it
52       succeeds  in setting the scheduling policy and scheduling parameters of
53       the process specified by pid to the values specified by policy and  the
54       structure pointed to by param, respectively.
55
56       See  Scheduling Policies for a description on how this function affects
57       the scheduling of the threads within the target process.
58
59       If the  current  scheduling  policy  for  the  target  process  is  not
60       SCHED_FIFO,  SCHED_RR, or SCHED_SPORADIC, the result is implementation-
61       defined; this case includes the SCHED_OTHER policy.
62
63       The specified sched_ss_repl_period shall be greater than  or  equal  to
64       the  specified  sched_ss_init_budget for the function to succeed; if it
65       is not, then the function shall fail.
66
67       The value of sched_ss_max_repl shall  be  within  the  inclusive  range
68       [1,{SS_REPL_MAX}]  for  the  function  to succeed; if not, the function
69       shall fail. It is  unspecified  whether  the  sched_ss_repl_period  and
70       sched_ss_init_budget  values are stored as provided by this function or
71       are rounded to align with the resolution of the clock being used.
72
73       This function is not atomic  with  respect  to  other  threads  in  the
74       process. Threads may continue to execute while this function call is in
75       the process of changing the scheduling policy and associated scheduling
76       parameters  for  the  underlying  kernel-scheduled entities used by the
77       process contention scope threads.
78

RETURN VALUE

80       Upon successful completion, the function shall return the former sched‐
81       uling  policy  of  the  specified  process. If the sched_setscheduler()
82       function fails to complete  successfully,  the  policy  and  scheduling
83       parameters  shall  remain  unchanged,  and  the function shall return a
84       value of -1 and set errno to indicate the error.
85

ERRORS

87       The sched_setscheduler() function shall fail if:
88
89       EINVAL The value of the policy parameter is invalid, or one or more  of
90              the parameters contained in param is outside the valid range for
91              the specified scheduling policy.
92
93       EPERM  The requesting process does not have permission to set either or
94              both  of  the  scheduling parameters or the scheduling policy of
95              the specified process.
96
97       ESRCH  No process can be found corresponding to that specified by pid.
98
99       The following sections are informative.
100

EXAMPLES

102       None.
103

APPLICATION USAGE

105       None.
106

RATIONALE

108       None.
109

FUTURE DIRECTIONS

111       None.
112

SEE ALSO

114       Scheduling Policies, sched_getparam(), sched_getscheduler(), sched_set‐
115       param()
116
117       The Base Definitions volume of POSIX.1‐2017, <sched.h>
118
120       Portions  of  this text are reprinted and reproduced in electronic form
121       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
122       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
123       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
124       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
125       event of any discrepancy between this version and the original IEEE and
126       The  Open Group Standard, the original IEEE and The Open Group Standard
127       is the referee document. The original Standard can be  obtained  online
128       at http://www.opengroup.org/unix/online.html .
129
130       Any  typographical  or  formatting  errors that appear in this page are
131       most likely to have been introduced during the conversion of the source
132       files  to  man page format. To report such errors, see https://www.ker
133       nel.org/doc/man-pages/reporting_bugs.html .
134
135
136
137IEEE/The Open Group                  2017               SCHED_SETSCHEDULER(3P)
Impressum