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