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