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