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