2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 #ifndef _MACH_TASK_POLICY_H_
32 #define _MACH_TASK_POLICY_H_
34 #include <mach/mach_types.h>
37 * These are the calls for accessing the policy parameters
38 * of a particular task.
40 * The extra 'get_default' parameter to the second call is
42 * 1) if asserted on the way in it indicates that the default
43 * values should be returned, not the ones currently set, in
44 * this case 'get_default' will always be asserted on return;
45 * 2) if unasserted on the way in, the current settings are
46 * desired and if still unasserted on return, then the info
47 * returned reflects the current settings, otherwise if
48 * 'get_default' returns asserted, it means that there are no
49 * current settings due to other parameters taking precedence,
50 * and the default ones are being returned instead.
53 typedef natural_t task_policy_flavor_t
;
54 typedef integer_t
*task_policy_t
;
57 kern_return_t task_policy_set(
59 task_policy_flavor_t flavor,
60 task_policy_t policy_info,
61 mach_msg_type_number_t count);
63 kern_return_t task_policy_get(
65 task_policy_flavor_t flavor,
66 task_policy_t policy_info,
67 mach_msg_type_number_t *count,
68 boolean_t *get_default);
75 * TASK_CATEGORY_POLICY:
77 * This provides information to the kernel about the role
78 * of the task in the system.
82 * role: Enumerated as follows:
84 * TASK_UNSPECIFIED is the default, since the role is not
85 * inherited from the parent.
87 * TASK_FOREGROUND_APPLICATION should be assigned when the
88 * task is a normal UI application in the foreground from
89 * the HI point of view.
90 * **N.B. There may be more than one of these at a given time.
92 * TASK_BACKGROUND_APPLICATION should be assigned when the
93 * task is a normal UI application in the background from
94 * the HI point of view.
96 * TASK_CONTROL_APPLICATION should be assigned to the unique
97 * UI application which implements the pop-up application dialog.
98 * There can only be one task at a time with this designation,
99 * which is assigned FCFS.
101 * TASK_GRAPHICS_SERVER should be assigned to the graphics
102 * management (window) server. There can only be one task at
103 * a time with this designation, which is assigned FCFS.
106 #define TASK_CATEGORY_POLICY 1
110 TASK_UNSPECIFIED
= 0,
111 TASK_FOREGROUND_APPLICATION
,
112 TASK_BACKGROUND_APPLICATION
,
113 TASK_CONTROL_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_ */