|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
4: * All Rights Reserved.
5: *
6: * Permission to use, copy, modify and distribute this software and its
7: * documentation is hereby granted, provided that both the copyright
8: * notice and this permission notice appear in all copies of the
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * File: mach/thread_info
28: *
29: * Thread information structure and definitions.
30: *
31: * The defintions in this file are exported to the user. The kernel
32: * will translate its internal data structures to these structures
33: * as appropriate.
34: *
35: */
36:
37: #ifndef _MACH_THREAD_INFO_H_
38: #define _MACH_THREAD_INFO_H_
39:
40: #include <mach/boolean.h>
41: #include <mach/policy.h>
42: #include <mach/time_value.h>
43:
44: /*
45: * Generic information structure to allow for expansion.
46: */
47: typedef integer_t *thread_info_t; /* varying array of ints */
48:
49: #define THREAD_INFO_MAX (1024) /* maximum array size */
50: typedef integer_t thread_info_data_t[THREAD_INFO_MAX];
51:
52: /*
53: * Currently defined information.
54: */
55: #define THREAD_BASIC_INFO 1 /* basic information */
56:
57: struct thread_basic_info {
58: time_value_t user_time; /* user run time */
59: time_value_t system_time; /* system run time */
60: integer_t cpu_usage; /* scaled cpu usage percentage */
61: integer_t base_priority; /* base scheduling priority */
62: integer_t cur_priority; /* current scheduling priority */
63: integer_t run_state; /* run state (see below) */
64: integer_t flags; /* various flags (see below) */
65: integer_t suspend_count; /* suspend count for thread */
66: integer_t sleep_time; /* number of seconds that thread
67: has been sleeping */
68: };
69:
70: typedef struct thread_basic_info thread_basic_info_data_t;
71: typedef struct thread_basic_info *thread_basic_info_t;
72: #define THREAD_BASIC_INFO_COUNT \
73: (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
74:
75: /*
76: * Scale factor for usage field.
77: */
78:
79: #define TH_USAGE_SCALE 1000
80:
81: /*
82: * Thread run states (state field).
83: */
84:
85: #define TH_STATE_RUNNING 1 /* thread is running normally */
86: #define TH_STATE_STOPPED 2 /* thread is stopped */
87: #define TH_STATE_WAITING 3 /* thread is waiting normally */
88: #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
89: wait */
90: #define TH_STATE_HALTED 5 /* thread is halted at a
91: clean point */
92:
93: /*
94: * Thread flags (flags field).
95: */
96: #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
97: #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
98:
99: #define THREAD_SCHED_INFO 2
100:
101: struct thread_sched_info {
102: integer_t policy; /* scheduling policy */
103: integer_t data; /* associated data */
104: integer_t base_priority; /* base priority */
105: integer_t max_priority; /* max priority */
106: integer_t cur_priority; /* current priority */
107: /*boolean_t*/integer_t depressed; /* depressed ? */
108: integer_t depress_priority; /* priority depressed from */
109: };
110:
111: typedef struct thread_sched_info thread_sched_info_data_t;
112: typedef struct thread_sched_info *thread_sched_info_t;
113: #define THREAD_SCHED_INFO_COUNT \
114: (sizeof(thread_sched_info_data_t) / sizeof(natural_t))
115:
116: #endif /* _MACH_THREAD_INFO_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.