]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/task_policy.h
xnu-2050.48.11.tar.gz
[apple/xnu.git] / osfmk / mach / task_policy.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b 27 */
1c79356b
A
28
29#ifndef _MACH_TASK_POLICY_H_
30#define _MACH_TASK_POLICY_H_
31
32#include <mach/mach_types.h>
33
34/*
35 * These are the calls for accessing the policy parameters
36 * of a particular task.
37 *
38 * The extra 'get_default' parameter to the second call is
39 * IN/OUT as follows:
40 * 1) if asserted on the way in it indicates that the default
41 * values should be returned, not the ones currently set, in
42 * this case 'get_default' will always be asserted on return;
43 * 2) if unasserted on the way in, the current settings are
44 * desired and if still unasserted on return, then the info
45 * returned reflects the current settings, otherwise if
46 * 'get_default' returns asserted, it means that there are no
47 * current settings due to other parameters taking precedence,
48 * and the default ones are being returned instead.
49 */
50
51typedef natural_t task_policy_flavor_t;
52typedef integer_t *task_policy_t;
53
54/*
55kern_return_t task_policy_set(
56 task_t task,
57 task_policy_flavor_t flavor,
58 task_policy_t policy_info,
59 mach_msg_type_number_t count);
60
61kern_return_t task_policy_get(
62 task_t task,
63 task_policy_flavor_t flavor,
64 task_policy_t policy_info,
65 mach_msg_type_number_t *count,
66 boolean_t *get_default);
67*/
68
69/*
70 * Defined flavors.
71 */
72/*
73 * TASK_CATEGORY_POLICY:
74 *
75 * This provides information to the kernel about the role
76 * of the task in the system.
77 *
78 * Parameters:
79 *
80 * role: Enumerated as follows:
81 *
82 * TASK_UNSPECIFIED is the default, since the role is not
83 * inherited from the parent.
84 *
85 * TASK_FOREGROUND_APPLICATION should be assigned when the
86 * task is a normal UI application in the foreground from
87 * the HI point of view.
88 * **N.B. There may be more than one of these at a given time.
89 *
90 * TASK_BACKGROUND_APPLICATION should be assigned when the
91 * task is a normal UI application in the background from
92 * the HI point of view.
93 *
94 * TASK_CONTROL_APPLICATION should be assigned to the unique
95 * UI application which implements the pop-up application dialog.
96 * There can only be one task at a time with this designation,
97 * which is assigned FCFS.
98 *
99 * TASK_GRAPHICS_SERVER should be assigned to the graphics
100 * management (window) server. There can only be one task at
101 * a time with this designation, which is assigned FCFS.
102 */
103
104#define TASK_CATEGORY_POLICY 1
105
0b4e3aa0
A
106enum task_role {
107 TASK_RENICED = -1,
108 TASK_UNSPECIFIED = 0,
109 TASK_FOREGROUND_APPLICATION,
110 TASK_BACKGROUND_APPLICATION,
111 TASK_CONTROL_APPLICATION,
b7266188
A
112 TASK_GRAPHICS_SERVER,
113 TASK_THROTTLE_APPLICATION,
6d2010ae 114 TASK_NONUI_APPLICATION,
b7266188 115 TASK_DEFAULT_APPLICATION
0b4e3aa0
A
116};
117
118typedef enum task_role task_role_t;
119
1c79356b 120struct task_category_policy {
0b4e3aa0 121 task_role_t role;
1c79356b
A
122};
123
124typedef struct task_category_policy task_category_policy_data_t;
125typedef struct task_category_policy *task_category_policy_t;
126
91447636
A
127#define TASK_CATEGORY_POLICY_COUNT ((mach_msg_type_number_t) \
128 (sizeof (task_category_policy_data_t) / sizeof (integer_t)))
1c79356b
A
129
130#endif /* _MACH_TASK_POLICY_H_ */