xref: /xnu-11417.101.15/osfmk/man/task_set_policy.html (revision e3723e1f17661b24996789d8afc084c0c3303b26)
1*e3723e1fSApple OSS Distributions<h2>task_set_policy</h2>
2*e3723e1fSApple OSS Distributions<hr>
3*e3723e1fSApple OSS Distributions<p>
4*e3723e1fSApple OSS Distributions<strong>Function</strong> - Set target task's default scheduling policy state. (Protected Interface.)
5*e3723e1fSApple OSS Distributions<h3>SYNOPSIS</h3>
6*e3723e1fSApple OSS Distributions<pre>
7*e3723e1fSApple OSS Distributions<strong>kern_return_t   task_set_policy</strong>
8*e3723e1fSApple OSS Distributions                <strong>(task_t</strong>                                    <var>task</var>,
9*e3723e1fSApple OSS Distributions                 <strong>processor_set_t</strong>                  <var>processor_set</var>,
10*e3723e1fSApple OSS Distributions                 <strong>policy_t</strong>                                <var>policy</var>,
11*e3723e1fSApple OSS Distributions                 <strong>policy_base_t</strong>                             <var>base</var>,
12*e3723e1fSApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>              <var>base_count</var>,
13*e3723e1fSApple OSS Distributions                 <strong>policy_limit_t</strong>                           <var>limit</var>,
14*e3723e1fSApple OSS Distributions                 <strong>mach_msg_type_number_t</strong>             <var>limit_count</var>,
15*e3723e1fSApple OSS Distributions                 <strong>boolean_t</strong>                       <var>change_threads</var><strong>);</strong>
16*e3723e1fSApple OSS Distributions</pre>
17*e3723e1fSApple OSS Distributions<h3>PARAMETERS</h3>
18*e3723e1fSApple OSS Distributions<dl>
19*e3723e1fSApple OSS Distributions<dt> <var>task</var>
20*e3723e1fSApple OSS Distributions<dd>
21*e3723e1fSApple OSS Distributions[in task send right]
22*e3723e1fSApple OSS DistributionsThe task whose scheduling policy is to be set.
23*e3723e1fSApple OSS Distributions<dt> <var>processor_set</var>
24*e3723e1fSApple OSS Distributions<dd>
25*e3723e1fSApple OSS Distributions[in processor-set-control send right]
26*e3723e1fSApple OSS DistributionsThe control port for the processor
27*e3723e1fSApple OSS Distributionsset to which the task is currently assigned.
28*e3723e1fSApple OSS Distributions<dt> <var>policy</var>
29*e3723e1fSApple OSS Distributions<dd>
30*e3723e1fSApple OSS Distributions[in scalar]
31*e3723e1fSApple OSS DistributionsPolicy to be set.  The values currently defined are <strong>POLICY_TIMESHARE</strong>,
32*e3723e1fSApple OSS Distributions<strong>POLICY_RR</strong> (round robin) and <strong>POLICY_FIFO</strong> (firstin, first-out).
33*e3723e1fSApple OSS Distributions<dt> <var>base</var>
34*e3723e1fSApple OSS Distributions<dd>
35*e3723e1fSApple OSS Distributions[pointer to in structure]
36*e3723e1fSApple OSS DistributionsBase policy specific data, <strong>policy_fifo_base</strong>,
37*e3723e1fSApple OSS Distributions<strong>policy_rr_base</strong> or <strong>policy_timeshare_base</strong>.
38*e3723e1fSApple OSS Distributions<dt> <var>base_count</var>
39*e3723e1fSApple OSS Distributions<dd>
40*e3723e1fSApple OSS Distributions[in scalar]
41*e3723e1fSApple OSS DistributionsThe size of the buffer (in natural-sized units).
42*e3723e1fSApple OSS Distributions<dt> <var>limit</var>
43*e3723e1fSApple OSS Distributions<dd>
44*e3723e1fSApple OSS Distributions[pointer to in structure]
45*e3723e1fSApple OSS DistributionsPolicy specific limits, <strong>policy_fifo_limit</strong>,
46*e3723e1fSApple OSS Distributions<strong>policy_rr_limit</strong> or <strong>policy_timeshare_limit</strong>.
47*e3723e1fSApple OSS Distributions<dt> <var>limit_count</var>
48*e3723e1fSApple OSS Distributions<dd>
49*e3723e1fSApple OSS Distributions[in scalar]
50*e3723e1fSApple OSS DistributionsThe size of the buffer (in natural-sized units).
51*e3723e1fSApple OSS Distributions<dt> <var>change_threads</var>
52*e3723e1fSApple OSS Distributions<dd>
53*e3723e1fSApple OSS Distributions[in scalar]
54*e3723e1fSApple OSS DistributionsTrue if the scheduling attributes for all contained threads
55*e3723e1fSApple OSS Distributionsshould be changed as well.
56*e3723e1fSApple OSS Distributions</dl>
57*e3723e1fSApple OSS Distributions<h3>DESCRIPTION</h3>
58*e3723e1fSApple OSS Distributions<p>
59*e3723e1fSApple OSS DistributionsThe <strong>task_set_policy</strong> function sets the scheduling attributes,
60*e3723e1fSApple OSS Distributionsboth base and limit, for <var>task</var>.
61*e3723e1fSApple OSS Distributions<var>policy</var> may be any policy implemented by the processor set whether or
62*e3723e1fSApple OSS Distributionsnot it is enabled.
63*e3723e1fSApple OSS Distributions<h3>RETURN VALUES</h3>
64*e3723e1fSApple OSS Distributions<dl>
65*e3723e1fSApple OSS Distributions<dt> <strong>KERN_INVALID_PROCESSOR_SET</strong>
66*e3723e1fSApple OSS Distributions<dd>
67*e3723e1fSApple OSS Distributions<var>processor_set</var> is not the task's processor set control port.
68*e3723e1fSApple OSS Distributions</dl>
69*e3723e1fSApple OSS Distributions<h3>RELATED INFORMATION</h3>
70*e3723e1fSApple OSS Distributions<p>
71*e3723e1fSApple OSS DistributionsFunctions:
72*e3723e1fSApple OSS Distributions<a href="P_set_policy_control.html"><strong>processor_set_policy_control</strong></a>,
73*e3723e1fSApple OSS Distributions<a href="thread_policy.html"><strong>thread_policy</strong></a>,
74*e3723e1fSApple OSS Distributions<a href="thread_set_policy.html"><strong>thread_set_policy</strong></a>,
75*e3723e1fSApple OSS Distributions<a href="task_policy.html"><strong>task_policy</strong></a>.
76*e3723e1fSApple OSS Distributions<p>
77*e3723e1fSApple OSS DistributionsData Structures:
78*e3723e1fSApple OSS Distributions<a href="policy_fifo_info.html"><strong>policy_fifo_info</strong></a>,
79*e3723e1fSApple OSS Distributions<a href="policy_rr_info.html"><strong>policy_rr_info</strong></a>,
80*e3723e1fSApple OSS Distributions<a href="policy_timeshare_info.html"><strong>policy_timeshare_info</strong></a>.
81