2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _MACH_TASK_POLICY_H_
30 #define _MACH_TASK_POLICY_H_
32 #include <mach/mach_types.h>
35 * These are the calls for accessing the policy parameters
36 * of a particular task.
38 * The extra 'get_default' parameter to the second call is
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.
51 typedef natural_t task_policy_flavor_t
;
52 typedef integer_t
*task_policy_t
;
55 kern_return_t task_policy_set(
57 task_policy_flavor_t flavor,
58 task_policy_t policy_info,
59 mach_msg_type_number_t count);
61 kern_return_t task_policy_get(
63 task_policy_flavor_t flavor,
64 task_policy_t policy_info,
65 mach_msg_type_number_t *count,
66 boolean_t *get_default);
73 * TASK_CATEGORY_POLICY:
75 * This provides information to the kernel about the role
76 * of the task in the system.
80 * role: Enumerated as follows:
82 * TASK_UNSPECIFIED is the default, since the role is not
83 * inherited from the parent.
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.
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.
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.
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.
104 #define TASK_CATEGORY_POLICY 1
108 TASK_UNSPECIFIED
= 0,
109 TASK_FOREGROUND_APPLICATION
,
110 TASK_BACKGROUND_APPLICATION
,
111 TASK_CONTROL_APPLICATION
,
112 TASK_GRAPHICS_SERVER
,
113 TASK_THROTTLE_APPLICATION
,
114 TASK_DEFAULT_APPLICATION
117 typedef enum task_role task_role_t
;
119 struct task_category_policy
{
123 typedef struct task_category_policy task_category_policy_data_t
;
124 typedef struct task_category_policy
*task_category_policy_t
;
126 #define TASK_CATEGORY_POLICY_COUNT ((mach_msg_type_number_t) \
127 (sizeof (task_category_policy_data_t) / sizeof (integer_t)))
129 #endif /* _MACH_TASK_POLICY_H_ */