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