darwin-xnu/osfmk/mach/task_policy.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
   3 *
   4 * @APPLE_LICENSE_HEADER_START@
   5 * 
   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.
  11 * 
  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
  14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  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.
  19 * 
  20 * @APPLE_LICENSE_HEADER_END@
  21 */
  22
  23#ifndef _MACH_TASK_POLICY_H_
  24#define _MACH_TASK_POLICY_H_
  25
  26#include <mach/mach_types.h>
  27
  28/*
  29 * These are the calls for accessing the policy parameters
  30 * of a particular task.
  31 *
  32 * The extra 'get_default' parameter to the second call is
  33 * IN/OUT as follows:
  34 * 1) if asserted on the way in it indicates that the default
  35 * values should be returned, not the ones currently set, in
  36 * this case 'get_default' will always be asserted on return;
  37 * 2) if unasserted on the way in, the current settings are
  38 * desired and if still unasserted on return, then the info
  39 * returned reflects the current settings, otherwise if
  40 * 'get_default' returns asserted, it means that there are no
  41 * current settings due to other parameters taking precedence,
  42 * and the default ones are being returned instead.
  43 */
  44
  45typedef natural_t       task_policy_flavor_t;
  46typedef integer_t       *task_policy_t;
  47
  48/*
  49kern_return_t   task_policy_set(
  50                                        task_t                                  task,
  51                                        task_policy_flavor_t    flavor,
  52                                        task_policy_t                   policy_info,
  53                                        mach_msg_type_number_t  count);
  54
  55kern_return_t   task_policy_get(
  56                                        task_t                                  task,
  57                                        task_policy_flavor_t    flavor,
  58                                        task_policy_t                   policy_info,
  59                                        mach_msg_type_number_t  *count,
  60                                        boolean_t                               *get_default);
  61*/
  62
  63/*
  64 * Defined flavors.
  65 */
  66/*
  67 * TASK_CATEGORY_POLICY:
  68 *
  69 * This provides information to the kernel about the role
  70 * of the task in the system.
  71 *
  72 * Parameters:
  73 *
  74 * role: Enumerated as follows:
  75 *
  76 * TASK_UNSPECIFIED is the default, since the role is not
  77 * inherited from the parent.
  78 *
  79 * TASK_FOREGROUND_APPLICATION should be assigned when the
  80 * task is a normal UI application in the foreground from
  81 * the HI point of view.
  82 * **N.B. There may be more than one of these at a given time.
  83 *
  84 * TASK_BACKGROUND_APPLICATION should be assigned when the
  85 * task is a normal UI application in the background from
  86 * the HI point of view.
  87 *
  88 * TASK_CONTROL_APPLICATION should be assigned to the unique
  89 * UI application which implements the pop-up application dialog.
  90 * There can only be one task at a time with this designation,
  91 * which is assigned FCFS.
  92 *
  93 * TASK_GRAPHICS_SERVER should be assigned to the graphics
  94 * management (window) server.  There can only be one task at
  95 * a time with this designation, which is assigned FCFS.
  96 */
  97
  98#define TASK_CATEGORY_POLICY            1
  99
 100enum task_role {
 101        TASK_RENICED = -1,
 102        TASK_UNSPECIFIED = 0,
 103        TASK_FOREGROUND_APPLICATION,
 104        TASK_BACKGROUND_APPLICATION,
 105        TASK_CONTROL_APPLICATION,
 106        TASK_GRAPHICS_SERVER
 107};
 108
 109typedef enum task_role          task_role_t;
 110
 111struct task_category_policy {
 112        task_role_t             role;
 113};
 114
 115typedef struct task_category_policy             task_category_policy_data_t;
 116typedef struct task_category_policy             *task_category_policy_t;
 117
 118#define TASK_CATEGORY_POLICY_COUNT      ((mach_msg_type_number_t) \
 119        (sizeof (task_category_policy_data_t) / sizeof (integer_t)))
 120
 121#endif  /* _MACH_TASK_POLICY_H_ */
 122
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.