|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1993-1988 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: task.h
28: * Author: Avadis Tevanian, Jr.
29: *
30: * This file contains the structure definitions for tasks.
31: *
32: */
33:
34: #ifndef _KERN_TASK_H_
35: #define _KERN_TASK_H_
36:
37: #include <norma_task.h>
38: #include <fast_tas.h>
39: #include <net_atm.h>
40:
41: #include <mach/boolean.h>
42: #include <mach/port.h>
43: #include <mach/time_value.h>
44: #include <mach/mach_param.h>
45: #include <mach/task_info.h>
46: #include <kern/kern_types.h>
47: #include <kern/lock.h>
48: #include <kern/queue.h>
49: #include <kern/pc_sample.h>
50: #include <kern/processor.h>
51: #include <kern/syscall_emulation.h>
52: #include <vm/vm_map.h>
53:
54: #if NET_ATM
55: typedef struct nw_ep_owned {
56: unsigned int ep;
57: struct nw_ep_owned *next;
58: } nw_ep_owned_s, *nw_ep_owned_t;
59: #endif
60:
61: struct task {
62: /* Synchronization/destruction information */
63: decl_simple_lock_data(,lock) /* Task's lock */
64: int ref_count; /* Number of references to me */
65: boolean_t active; /* Task has not been terminated */
66:
67: /* Miscellaneous */
68: vm_map_t map; /* Address space description */
69: queue_chain_t pset_tasks; /* list of tasks assigned to pset */
70: int suspend_count; /* Internal scheduling only */
71:
72: /* Thread information */
73: queue_head_t thread_list; /* list of threads */
74: int thread_count; /* number of threads */
75: processor_set_t processor_set; /* processor set for new threads */
76: boolean_t may_assign; /* can assigned pset be changed? */
77: boolean_t assign_active; /* waiting for may_assign */
78:
79: /* User-visible scheduling information */
80: int user_stop_count; /* outstanding stops */
81: int priority; /* for new threads */
82:
83: /* Statistics */
84: time_value_t total_user_time;
85: /* total user time for dead threads */
86: time_value_t total_system_time;
87: /* total system time for dead threads */
88:
1.1.1.2 ! root 89: time_value_t creation_time; /* time stamp at creation */
! 90:
1.1 root 91: /* IPC structures */
92: decl_simple_lock_data(, itk_lock_data)
93: struct ipc_port *itk_self; /* not a right, doesn't hold ref */
94: struct ipc_port *itk_sself; /* a send right */
95: struct ipc_port *itk_exception; /* a send right */
96: struct ipc_port *itk_bootstrap; /* a send right */
97: struct ipc_port *itk_registered[TASK_PORT_REGISTER_MAX];
98: /* all send rights */
99:
100: struct ipc_space *itk_space;
101:
102: /* User space system call emulation support */
103: struct eml_dispatch *eml_dispatch;
104:
105: sample_control_t pc_sample;
106:
107: #if NORMA_TASK
108: long child_node; /* if != -1, node for new children */
109: #endif /* NORMA_TASK */
110:
111: #if FAST_TAS
112: #define TASK_FAST_TAS_NRAS 8
113: vm_offset_t fast_tas_base[TASK_FAST_TAS_NRAS];
114: vm_offset_t fast_tas_end[TASK_FAST_TAS_NRAS];
115: #endif /* FAST_TAS */
116:
117: #if NET_ATM
118: nw_ep_owned_t nw_ep_owned;
119: #endif /* NET_ATM */
120: };
121:
122: #define task_lock(task) simple_lock(&(task)->lock)
123: #define task_unlock(task) simple_unlock(&(task)->lock)
124:
125: #define itk_lock_init(task) simple_lock_init(&(task)->itk_lock_data)
126: #define itk_lock(task) simple_lock(&(task)->itk_lock_data)
127: #define itk_unlock(task) simple_unlock(&(task)->itk_lock_data)
128:
129: /*
130: * Exported routines/macros
131: */
132:
133: extern kern_return_t task_create(
134: task_t parent_task,
135: boolean_t inherit_memory,
136: task_t *child_task);
137: extern kern_return_t task_terminate(
138: task_t task);
139: extern kern_return_t task_suspend(
140: task_t task);
141: extern kern_return_t task_resume(
142: task_t task);
143: extern kern_return_t task_threads(
144: task_t task,
145: thread_array_t *thread_list,
146: natural_t *count);
147: extern kern_return_t task_info(
148: task_t task,
149: int flavor,
150: task_info_t task_info_out,
151: natural_t *task_info_count);
152: extern kern_return_t task_get_special_port(
153: task_t task,
154: int which,
155: struct ipc_port **portp);
156: extern kern_return_t task_set_special_port(
157: task_t task,
158: int which,
159: struct ipc_port *port);
160: extern kern_return_t task_assign(
161: task_t task,
162: processor_set_t new_pset,
163: boolean_t assign_threads);
164: extern kern_return_t task_assign_default(
165: task_t task,
166: boolean_t assign_threads);
167:
168: /*
169: * Internal only routines
170: */
171:
172: extern void task_init();
173: extern void task_reference();
174: extern void task_deallocate();
175: extern kern_return_t task_hold();
176: extern kern_return_t task_dowait();
177: extern kern_return_t task_release();
178: extern kern_return_t task_halt();
179:
180: extern kern_return_t task_suspend_nowait();
181: extern task_t kernel_task_create();
182:
183: extern task_t kernel_task;
184:
185: #endif _KERN_TASK_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.