Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/mach/task_policy.h

1/*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _MACH_TASK_POLICY_H_
30#define _MACH_TASK_POLICY_H_
31
32#include <mach/mach_types.h>
33
34/*
35 * These are the calls for accessing the policy parameters
36 * of a particular task.
37 *
38 * The extra 'get_default' parameter to the second call is
39 * IN/OUT as follows:
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.
49 */
50
51typedef natural_ttask_policy_flavor_t;
52typedef integer_t*task_policy_t;
53
54/*
55kern_return_ttask_policy_set(
56task_ttask,
57task_policy_flavor_tflavor,
58task_policy_tpolicy_info,
59mach_msg_type_number_tcount);
60
61kern_return_ttask_policy_get(
62task_ttask,
63task_policy_flavor_tflavor,
64task_policy_tpolicy_info,
65mach_msg_type_number_t*count,
66boolean_t*get_default);
67*/
68
69/*
70 * Defined flavors.
71 */
72/*
73 * TASK_CATEGORY_POLICY:
74 *
75 * This provides information to the kernel about the role
76 * of the task in the system.
77 *
78 * Parameters:
79 *
80 * role: Enumerated as follows:
81 *
82 * TASK_UNSPECIFIED is the default, since the role is not
83 * inherited from the parent.
84 *
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.
89 *
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.
93 *
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.
98 *
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.
102 */
103
104#define TASK_CATEGORY_POLICY1
105
106enum task_role {
107TASK_RENICED = -1,
108TASK_UNSPECIFIED = 0,
109TASK_FOREGROUND_APPLICATION,
110TASK_BACKGROUND_APPLICATION,
111TASK_CONTROL_APPLICATION,
112TASK_GRAPHICS_SERVER,
113TASK_THROTTLE_APPLICATION,
114TASK_DEFAULT_APPLICATION
115};
116
117typedef enum task_roletask_role_t;
118
119struct task_category_policy {
120task_role_trole;
121};
122
123typedef struct task_category_policytask_category_policy_data_t;
124typedef struct task_category_policy*task_category_policy_t;
125
126#define TASK_CATEGORY_POLICY_COUNT((mach_msg_type_number_t) \
127(sizeof (task_category_policy_data_t) / sizeof (integer_t)))
128
129#endif/* _MACH_TASK_POLICY_H_ */
130

Archive Download this file

Revision: 1340