|
|
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: time_value_t creation_time; /* time stamp of creation */
69: };
70:
71: typedef struct thread_basic_info thread_basic_info_data_t;
72: typedef struct thread_basic_info *thread_basic_info_t;
73: #define THREAD_BASIC_INFO_COUNT \
74: (sizeof(thread_basic_info_data_t) / sizeof(natural_t))
75:
76: /*
77: * Scale factor for usage field.
78: */
79:
80: #define TH_USAGE_SCALE 1000
81:
82: /*
83: * Thread run states (state field).
84: */
85:
86: #define TH_STATE_RUNNING 1 /* thread is running normally */
87: #define TH_STATE_STOPPED 2 /* thread is stopped */
88: #define TH_STATE_WAITING 3 /* thread is waiting normally */
89: #define TH_STATE_UNINTERRUPTIBLE 4 /* thread is in an uninterruptible
90: wait */
91: #define TH_STATE_HALTED 5 /* thread is halted at a
92: clean point */
93:
94: /*
95: * Thread flags (flags field).
96: */
97: #define TH_FLAGS_SWAPPED 0x1 /* thread is swapped out */
98: #define TH_FLAGS_IDLE 0x2 /* thread is an idle thread */
99:
100: #define THREAD_SCHED_INFO 2
101:
102: struct thread_sched_info {
103: integer_t policy; /* scheduling policy */
104: integer_t data; /* associated data */
105: integer_t base_priority; /* base priority */
106: integer_t max_priority; /* max priority */
107: integer_t cur_priority; /* current priority */
108: /*boolean_t*/integer_t depressed; /* depressed ? */
109: integer_t depress_priority; /* priority depressed from */
110: };
111:
112: typedef struct thread_sched_info thread_sched_info_data_t;
113: typedef struct thread_sched_info *thread_sched_info_t;
114: #define THREAD_SCHED_INFO_COUNT \
115: (sizeof(thread_sched_info_data_t) / sizeof(natural_t))
116:
117: #endif /* _MACH_THREAD_INFO_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.