]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
37839358 A |
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. | |
1c79356b | 11 | * |
37839358 A |
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 | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
37839358 A |
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. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
1c79356b A |
25 | /* |
26 | * Mach Operating System | |
27 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University | |
28 | * All Rights Reserved. | |
29 | * | |
30 | * Permission to use, copy, modify and distribute this software and its | |
31 | * documentation is hereby granted, provided that both the copyright | |
32 | * notice and this permission notice appear in all copies of the | |
33 | * software, derivative works or modified versions, and any portions | |
34 | * thereof, and that both notices appear in supporting documentation. | |
35 | * | |
36 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
37 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
38 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
39 | * | |
40 | * Carnegie Mellon requests users of this software to return to | |
41 | * | |
42 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
43 | * School of Computer Science | |
44 | * Carnegie Mellon University | |
45 | * Pittsburgh PA 15213-3890 | |
46 | * | |
47 | * any improvements or extensions that they make and grant Carnegie Mellon | |
48 | * the rights to redistribute these changes. | |
49 | */ | |
50 | /* | |
51 | */ | |
52 | /* | |
53 | * File: mach/thread_info | |
54 | * | |
55 | * Thread information structure and definitions. | |
56 | * | |
57 | * The defintions in this file are exported to the user. The kernel | |
58 | * will translate its internal data structures to these structures | |
59 | * as appropriate. | |
60 | * | |
61 | */ | |
62 | ||
63 | #ifndef _MACH_THREAD_INFO_H_ | |
64 | #define _MACH_THREAD_INFO_H_ | |
65 | ||
66 | #include <mach/boolean.h> | |
67 | #include <mach/policy.h> | |
68 | #include <mach/time_value.h> | |
91447636 | 69 | #include <mach/message.h> |
1c79356b A |
70 | #include <mach/machine/vm_types.h> |
71 | ||
72 | /* | |
73 | * Generic information structure to allow for expansion. | |
74 | */ | |
75 | typedef natural_t thread_flavor_t; | |
76 | typedef integer_t *thread_info_t; /* varying array of int */ | |
77 | ||
78 | #define THREAD_INFO_MAX (1024) /* maximum array size */ | |
79 | typedef integer_t thread_info_data_t[THREAD_INFO_MAX]; | |
80 | ||
81 | /* | |
82 | * Currently defined information. | |
83 | */ | |
84 | #define THREAD_BASIC_INFO 3 /* basic information */ | |
85 | ||
86 | struct thread_basic_info { | |
87 | time_value_t user_time; /* user run time */ | |
88 | time_value_t system_time; /* system run time */ | |
89 | integer_t cpu_usage; /* scaled cpu usage percentage */ | |
90 | policy_t policy; /* scheduling policy in effect */ | |
91 | integer_t run_state; /* run state (see below) */ | |
92 | integer_t flags; /* various flags (see below) */ | |
93 | integer_t suspend_count; /* suspend count for thread */ | |
94 | integer_t sleep_time; /* number of seconds that thread | |
95 | has been sleeping */ | |
96 | }; | |
97 | ||
98 | typedef struct thread_basic_info thread_basic_info_data_t; | |
99 | typedef struct thread_basic_info *thread_basic_info_t; | |
91447636 A |
100 | #define THREAD_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ |
101 | (sizeof(thread_basic_info_data_t) / sizeof(natural_t))) | |
1c79356b A |
102 | |
103 | /* | |
104 | * Scale factor for usage field. | |
105 | */ | |
106 | ||
107 | #define TH_USAGE_SCALE 1000 | |
108 | ||
109 | /* | |
110 | * Thread run states (state field). | |
111 | */ | |
112 | ||
113 | #define TH_STATE_RUNNING 1 /* thread is running normally */ | |
114 | #define TH_STATE_STOPPED 2 /* thread is stopped */ | |
115 | #define TH_STATE_WAITING 3 /* thread is waiting normally */ | |
116 | #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible | |
117 | wait */ | |
118 | #define TH_STATE_HALTED 5 /* thread is halted at a | |
119 | clean point */ | |
120 | ||
121 | /* | |
122 | * Thread flags (flags field). | |
123 | */ | |
124 | #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */ | |
125 | #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */ | |
126 | ||
91447636 A |
127 | /* |
128 | * Obsolete interfaces. | |
129 | */ | |
9bccf70c | 130 | |
1c79356b A |
131 | #define THREAD_SCHED_TIMESHARE_INFO 10 |
132 | #define THREAD_SCHED_RR_INFO 11 | |
133 | #define THREAD_SCHED_FIFO_INFO 12 | |
134 | ||
135 | #endif /* _MACH_THREAD_INFO_H_ */ |