1 | #ifndef _processor_set_server_ |
2 | #define _processor_set_server_ |
3 | |
4 | /* Module processor_set */ |
5 | |
6 | #include <string.h> |
7 | #include <mach/ndr.h> |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/notify.h> |
11 | #include <mach/mach_types.h> |
12 | #include <mach/message.h> |
13 | #include <mach/mig_errors.h> |
14 | #include <mach/port.h> |
15 | |
16 | /* BEGIN MIG_STRNCPY_ZEROFILL CODE */ |
17 | |
18 | #if defined(__has_include) |
19 | #if __has_include(<mach/mig_strncpy_zerofill_support.h>) |
20 | #ifndef USING_MIG_STRNCPY_ZEROFILL |
21 | #define USING_MIG_STRNCPY_ZEROFILL |
22 | #endif |
23 | #ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
24 | #define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ |
25 | #ifdef __cplusplus |
26 | extern "C" { |
27 | #endif |
28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
34 | #endif /* __has_include */ |
35 | |
36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
37 | |
38 | |
39 | #ifdef AUTOTEST |
40 | #ifndef FUNCTION_PTR_T |
41 | #define FUNCTION_PTR_T |
42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
43 | typedef struct { |
44 | char *name; |
45 | function_ptr_t function; |
46 | } function_table_entry; |
47 | typedef function_table_entry *function_table_t; |
48 | #endif /* FUNCTION_PTR_T */ |
49 | #endif /* AUTOTEST */ |
50 | |
51 | #ifndef processor_set_MSG_COUNT |
52 | #define processor_set_MSG_COUNT 10 |
53 | #endif /* processor_set_MSG_COUNT */ |
54 | |
55 | #include <mach/std_types.h> |
56 | #include <mach/mig.h> |
57 | #include <ipc/ipc_voucher.h> |
58 | #include <kern/ipc_kobject.h> |
59 | #include <kern/ipc_tt.h> |
60 | #include <kern/ipc_host.h> |
61 | #include <kern/ipc_sync.h> |
62 | #include <kern/ledger.h> |
63 | #include <kern/processor.h> |
64 | #include <kern/sync_lock.h> |
65 | #include <kern/sync_sema.h> |
66 | #include <vm/memory_object.h> |
67 | #include <vm/vm_map.h> |
68 | #include <kern/ipc_mig.h> |
69 | #include <mach/mig.h> |
70 | #include <mach/mach_types.h> |
71 | |
72 | #ifdef __BeforeMigServerHeader |
73 | __BeforeMigServerHeader |
74 | #endif /* __BeforeMigServerHeader */ |
75 | |
76 | |
77 | /* Routine processor_set_statistics */ |
78 | #ifdef mig_external |
79 | mig_external |
80 | #else |
81 | extern |
82 | #endif /* mig_external */ |
83 | kern_return_t processor_set_statistics |
84 | ( |
85 | processor_set_name_t pset, |
86 | processor_set_flavor_t flavor, |
87 | processor_set_info_t info_out, |
88 | mach_msg_type_number_t *info_outCnt |
89 | ); |
90 | |
91 | /* Routine processor_set_destroy */ |
92 | #ifdef mig_external |
93 | mig_external |
94 | #else |
95 | extern |
96 | #endif /* mig_external */ |
97 | kern_return_t processor_set_destroy |
98 | ( |
99 | processor_set_t set |
100 | ); |
101 | |
102 | /* Routine processor_set_max_priority */ |
103 | #ifdef mig_external |
104 | mig_external |
105 | #else |
106 | extern |
107 | #endif /* mig_external */ |
108 | kern_return_t processor_set_max_priority |
109 | ( |
110 | processor_set_t processor_set, |
111 | int max_priority, |
112 | boolean_t change_threads |
113 | ); |
114 | |
115 | /* Routine processor_set_policy_enable */ |
116 | #ifdef mig_external |
117 | mig_external |
118 | #else |
119 | extern |
120 | #endif /* mig_external */ |
121 | kern_return_t processor_set_policy_enable |
122 | ( |
123 | processor_set_t processor_set, |
124 | int policy |
125 | ); |
126 | |
127 | /* Routine processor_set_policy_disable */ |
128 | #ifdef mig_external |
129 | mig_external |
130 | #else |
131 | extern |
132 | #endif /* mig_external */ |
133 | kern_return_t processor_set_policy_disable |
134 | ( |
135 | processor_set_t processor_set, |
136 | int policy, |
137 | boolean_t change_threads |
138 | ); |
139 | |
140 | /* Routine processor_set_tasks */ |
141 | #ifdef mig_external |
142 | mig_external |
143 | #else |
144 | extern |
145 | #endif /* mig_external */ |
146 | kern_return_t processor_set_tasks |
147 | ( |
148 | processor_set_t processor_set, |
149 | task_array_t *task_list, |
150 | mach_msg_type_number_t *task_listCnt |
151 | ); |
152 | |
153 | /* Routine processor_set_threads */ |
154 | #ifdef mig_external |
155 | mig_external |
156 | #else |
157 | extern |
158 | #endif /* mig_external */ |
159 | kern_return_t processor_set_threads |
160 | ( |
161 | processor_set_t processor_set, |
162 | thread_act_array_t *thread_list, |
163 | mach_msg_type_number_t *thread_listCnt |
164 | ); |
165 | |
166 | /* Routine processor_set_policy_control */ |
167 | #ifdef mig_external |
168 | mig_external |
169 | #else |
170 | extern |
171 | #endif /* mig_external */ |
172 | kern_return_t processor_set_policy_control |
173 | ( |
174 | processor_set_t pset, |
175 | processor_set_flavor_t flavor, |
176 | processor_set_info_t policy_info, |
177 | mach_msg_type_number_t policy_infoCnt, |
178 | boolean_t change |
179 | ); |
180 | |
181 | /* Routine processor_set_stack_usage */ |
182 | #ifdef mig_external |
183 | mig_external |
184 | #else |
185 | extern |
186 | #endif /* mig_external */ |
187 | kern_return_t processor_set_stack_usage |
188 | ( |
189 | processor_set_t pset, |
190 | unsigned *ltotal, |
191 | vm_size_t *space, |
192 | vm_size_t *resident, |
193 | vm_size_t *maxusage, |
194 | vm_offset_t *maxstack |
195 | ); |
196 | |
197 | /* Routine processor_set_info */ |
198 | #ifdef mig_external |
199 | mig_external |
200 | #else |
201 | extern |
202 | #endif /* mig_external */ |
203 | kern_return_t processor_set_info |
204 | ( |
205 | processor_set_name_t set_name, |
206 | int flavor, |
207 | host_t *host, |
208 | processor_set_info_t info_out, |
209 | mach_msg_type_number_t *info_outCnt |
210 | ); |
211 | |
212 | #ifdef mig_external |
213 | mig_external |
214 | #else |
215 | extern |
216 | #endif /* mig_external */ |
217 | boolean_t processor_set_server( |
218 | mach_msg_header_t *InHeadP, |
219 | mach_msg_header_t *OutHeadP); |
220 | |
221 | #ifdef mig_external |
222 | mig_external |
223 | #else |
224 | extern |
225 | #endif /* mig_external */ |
226 | mig_routine_t processor_set_server_routine( |
227 | mach_msg_header_t *InHeadP); |
228 | |
229 | |
230 | /* Description of this subsystem, for use in direct RPC */ |
231 | extern const struct processor_set_subsystem { |
232 | mig_server_routine_t server; /* Server routine */ |
233 | mach_msg_id_t start; /* Min routine number */ |
234 | mach_msg_id_t end; /* Max routine number + 1 */ |
235 | unsigned int maxsize; /* Max msg size */ |
236 | vm_address_t reserved; /* Reserved */ |
237 | struct routine_descriptor /*Array of routine descriptors */ |
238 | routine[10]; |
239 | } processor_set_subsystem; |
240 | |
241 | /* typedefs for all requests */ |
242 | |
243 | #ifndef __Request__processor_set_subsystem__defined |
244 | #define __Request__processor_set_subsystem__defined |
245 | |
246 | #ifdef __MigPackStructs |
247 | #pragma pack(4) |
248 | #endif |
249 | typedef struct { |
250 | mach_msg_header_t Head; |
251 | NDR_record_t NDR; |
252 | processor_set_flavor_t flavor; |
253 | mach_msg_type_number_t info_outCnt; |
254 | } __Request__processor_set_statistics_t __attribute__((unused)); |
255 | #ifdef __MigPackStructs |
256 | #pragma pack() |
257 | #endif |
258 | |
259 | #ifdef __MigPackStructs |
260 | #pragma pack(4) |
261 | #endif |
262 | typedef struct { |
263 | mach_msg_header_t Head; |
264 | } __Request__processor_set_destroy_t __attribute__((unused)); |
265 | #ifdef __MigPackStructs |
266 | #pragma pack() |
267 | #endif |
268 | |
269 | #ifdef __MigPackStructs |
270 | #pragma pack(4) |
271 | #endif |
272 | typedef struct { |
273 | mach_msg_header_t Head; |
274 | NDR_record_t NDR; |
275 | int max_priority; |
276 | boolean_t change_threads; |
277 | } __Request__processor_set_max_priority_t __attribute__((unused)); |
278 | #ifdef __MigPackStructs |
279 | #pragma pack() |
280 | #endif |
281 | |
282 | #ifdef __MigPackStructs |
283 | #pragma pack(4) |
284 | #endif |
285 | typedef struct { |
286 | mach_msg_header_t Head; |
287 | NDR_record_t NDR; |
288 | int policy; |
289 | } __Request__processor_set_policy_enable_t __attribute__((unused)); |
290 | #ifdef __MigPackStructs |
291 | #pragma pack() |
292 | #endif |
293 | |
294 | #ifdef __MigPackStructs |
295 | #pragma pack(4) |
296 | #endif |
297 | typedef struct { |
298 | mach_msg_header_t Head; |
299 | NDR_record_t NDR; |
300 | int policy; |
301 | boolean_t change_threads; |
302 | } __Request__processor_set_policy_disable_t __attribute__((unused)); |
303 | #ifdef __MigPackStructs |
304 | #pragma pack() |
305 | #endif |
306 | |
307 | #ifdef __MigPackStructs |
308 | #pragma pack(4) |
309 | #endif |
310 | typedef struct { |
311 | mach_msg_header_t Head; |
312 | } __Request__processor_set_tasks_t __attribute__((unused)); |
313 | #ifdef __MigPackStructs |
314 | #pragma pack() |
315 | #endif |
316 | |
317 | #ifdef __MigPackStructs |
318 | #pragma pack(4) |
319 | #endif |
320 | typedef struct { |
321 | mach_msg_header_t Head; |
322 | } __Request__processor_set_threads_t __attribute__((unused)); |
323 | #ifdef __MigPackStructs |
324 | #pragma pack() |
325 | #endif |
326 | |
327 | #ifdef __MigPackStructs |
328 | #pragma pack(4) |
329 | #endif |
330 | typedef struct { |
331 | mach_msg_header_t Head; |
332 | NDR_record_t NDR; |
333 | processor_set_flavor_t flavor; |
334 | mach_msg_type_number_t policy_infoCnt; |
335 | integer_t policy_info[5]; |
336 | boolean_t change; |
337 | } __Request__processor_set_policy_control_t __attribute__((unused)); |
338 | #ifdef __MigPackStructs |
339 | #pragma pack() |
340 | #endif |
341 | |
342 | #ifdef __MigPackStructs |
343 | #pragma pack(4) |
344 | #endif |
345 | typedef struct { |
346 | mach_msg_header_t Head; |
347 | } __Request__processor_set_stack_usage_t __attribute__((unused)); |
348 | #ifdef __MigPackStructs |
349 | #pragma pack() |
350 | #endif |
351 | |
352 | #ifdef __MigPackStructs |
353 | #pragma pack(4) |
354 | #endif |
355 | typedef struct { |
356 | mach_msg_header_t Head; |
357 | NDR_record_t NDR; |
358 | int flavor; |
359 | mach_msg_type_number_t info_outCnt; |
360 | } __Request__processor_set_info_t __attribute__((unused)); |
361 | #ifdef __MigPackStructs |
362 | #pragma pack() |
363 | #endif |
364 | #endif /* !__Request__processor_set_subsystem__defined */ |
365 | |
366 | |
367 | /* union of all requests */ |
368 | |
369 | #ifndef __RequestUnion__processor_set_subsystem__defined |
370 | #define __RequestUnion__processor_set_subsystem__defined |
371 | union __RequestUnion__processor_set_subsystem { |
372 | __Request__processor_set_statistics_t Request_processor_set_statistics; |
373 | __Request__processor_set_destroy_t Request_processor_set_destroy; |
374 | __Request__processor_set_max_priority_t Request_processor_set_max_priority; |
375 | __Request__processor_set_policy_enable_t Request_processor_set_policy_enable; |
376 | __Request__processor_set_policy_disable_t Request_processor_set_policy_disable; |
377 | __Request__processor_set_tasks_t Request_processor_set_tasks; |
378 | __Request__processor_set_threads_t Request_processor_set_threads; |
379 | __Request__processor_set_policy_control_t Request_processor_set_policy_control; |
380 | __Request__processor_set_stack_usage_t Request_processor_set_stack_usage; |
381 | __Request__processor_set_info_t Request_processor_set_info; |
382 | }; |
383 | #endif /* __RequestUnion__processor_set_subsystem__defined */ |
384 | /* typedefs for all replies */ |
385 | |
386 | #ifndef __Reply__processor_set_subsystem__defined |
387 | #define __Reply__processor_set_subsystem__defined |
388 | |
389 | #ifdef __MigPackStructs |
390 | #pragma pack(4) |
391 | #endif |
392 | typedef struct { |
393 | mach_msg_header_t Head; |
394 | NDR_record_t NDR; |
395 | kern_return_t RetCode; |
396 | mach_msg_type_number_t info_outCnt; |
397 | integer_t info_out[5]; |
398 | } __Reply__processor_set_statistics_t __attribute__((unused)); |
399 | #ifdef __MigPackStructs |
400 | #pragma pack() |
401 | #endif |
402 | |
403 | #ifdef __MigPackStructs |
404 | #pragma pack(4) |
405 | #endif |
406 | typedef struct { |
407 | mach_msg_header_t Head; |
408 | NDR_record_t NDR; |
409 | kern_return_t RetCode; |
410 | } __Reply__processor_set_destroy_t __attribute__((unused)); |
411 | #ifdef __MigPackStructs |
412 | #pragma pack() |
413 | #endif |
414 | |
415 | #ifdef __MigPackStructs |
416 | #pragma pack(4) |
417 | #endif |
418 | typedef struct { |
419 | mach_msg_header_t Head; |
420 | NDR_record_t NDR; |
421 | kern_return_t RetCode; |
422 | } __Reply__processor_set_max_priority_t __attribute__((unused)); |
423 | #ifdef __MigPackStructs |
424 | #pragma pack() |
425 | #endif |
426 | |
427 | #ifdef __MigPackStructs |
428 | #pragma pack(4) |
429 | #endif |
430 | typedef struct { |
431 | mach_msg_header_t Head; |
432 | NDR_record_t NDR; |
433 | kern_return_t RetCode; |
434 | } __Reply__processor_set_policy_enable_t __attribute__((unused)); |
435 | #ifdef __MigPackStructs |
436 | #pragma pack() |
437 | #endif |
438 | |
439 | #ifdef __MigPackStructs |
440 | #pragma pack(4) |
441 | #endif |
442 | typedef struct { |
443 | mach_msg_header_t Head; |
444 | NDR_record_t NDR; |
445 | kern_return_t RetCode; |
446 | } __Reply__processor_set_policy_disable_t __attribute__((unused)); |
447 | #ifdef __MigPackStructs |
448 | #pragma pack() |
449 | #endif |
450 | |
451 | #ifdef __MigPackStructs |
452 | #pragma pack(4) |
453 | #endif |
454 | typedef struct { |
455 | mach_msg_header_t Head; |
456 | /* start of the kernel processed data */ |
457 | mach_msg_body_t msgh_body; |
458 | mach_msg_ool_ports_descriptor_t task_list; |
459 | /* end of the kernel processed data */ |
460 | NDR_record_t NDR; |
461 | mach_msg_type_number_t task_listCnt; |
462 | } __Reply__processor_set_tasks_t __attribute__((unused)); |
463 | #ifdef __MigPackStructs |
464 | #pragma pack() |
465 | #endif |
466 | |
467 | #ifdef __MigPackStructs |
468 | #pragma pack(4) |
469 | #endif |
470 | typedef struct { |
471 | mach_msg_header_t Head; |
472 | /* start of the kernel processed data */ |
473 | mach_msg_body_t msgh_body; |
474 | mach_msg_ool_ports_descriptor_t thread_list; |
475 | /* end of the kernel processed data */ |
476 | NDR_record_t NDR; |
477 | mach_msg_type_number_t thread_listCnt; |
478 | } __Reply__processor_set_threads_t __attribute__((unused)); |
479 | #ifdef __MigPackStructs |
480 | #pragma pack() |
481 | #endif |
482 | |
483 | #ifdef __MigPackStructs |
484 | #pragma pack(4) |
485 | #endif |
486 | typedef struct { |
487 | mach_msg_header_t Head; |
488 | NDR_record_t NDR; |
489 | kern_return_t RetCode; |
490 | } __Reply__processor_set_policy_control_t __attribute__((unused)); |
491 | #ifdef __MigPackStructs |
492 | #pragma pack() |
493 | #endif |
494 | |
495 | #ifdef __MigPackStructs |
496 | #pragma pack(4) |
497 | #endif |
498 | typedef struct { |
499 | mach_msg_header_t Head; |
500 | NDR_record_t NDR; |
501 | kern_return_t RetCode; |
502 | unsigned ltotal; |
503 | vm_size_t space; |
504 | vm_size_t resident; |
505 | vm_size_t maxusage; |
506 | vm_offset_t maxstack; |
507 | } __Reply__processor_set_stack_usage_t __attribute__((unused)); |
508 | #ifdef __MigPackStructs |
509 | #pragma pack() |
510 | #endif |
511 | |
512 | #ifdef __MigPackStructs |
513 | #pragma pack(4) |
514 | #endif |
515 | typedef struct { |
516 | mach_msg_header_t Head; |
517 | /* start of the kernel processed data */ |
518 | mach_msg_body_t msgh_body; |
519 | mach_msg_port_descriptor_t host; |
520 | /* end of the kernel processed data */ |
521 | NDR_record_t NDR; |
522 | mach_msg_type_number_t info_outCnt; |
523 | integer_t info_out[5]; |
524 | } __Reply__processor_set_info_t __attribute__((unused)); |
525 | #ifdef __MigPackStructs |
526 | #pragma pack() |
527 | #endif |
528 | #endif /* !__Reply__processor_set_subsystem__defined */ |
529 | |
530 | |
531 | /* union of all replies */ |
532 | |
533 | #ifndef __ReplyUnion__processor_set_subsystem__defined |
534 | #define __ReplyUnion__processor_set_subsystem__defined |
535 | union __ReplyUnion__processor_set_subsystem { |
536 | __Reply__processor_set_statistics_t Reply_processor_set_statistics; |
537 | __Reply__processor_set_destroy_t Reply_processor_set_destroy; |
538 | __Reply__processor_set_max_priority_t Reply_processor_set_max_priority; |
539 | __Reply__processor_set_policy_enable_t Reply_processor_set_policy_enable; |
540 | __Reply__processor_set_policy_disable_t Reply_processor_set_policy_disable; |
541 | __Reply__processor_set_tasks_t Reply_processor_set_tasks; |
542 | __Reply__processor_set_threads_t Reply_processor_set_threads; |
543 | __Reply__processor_set_policy_control_t Reply_processor_set_policy_control; |
544 | __Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage; |
545 | __Reply__processor_set_info_t Reply_processor_set_info; |
546 | }; |
547 | #endif /* __RequestUnion__processor_set_subsystem__defined */ |
548 | |
549 | #ifndef subsystem_to_name_map_processor_set |
550 | #define subsystem_to_name_map_processor_set \ |
551 | { "processor_set_statistics", 4000 },\ |
552 | { "processor_set_destroy", 4001 },\ |
553 | { "processor_set_max_priority", 4002 },\ |
554 | { "processor_set_policy_enable", 4003 },\ |
555 | { "processor_set_policy_disable", 4004 },\ |
556 | { "processor_set_tasks", 4005 },\ |
557 | { "processor_set_threads", 4006 },\ |
558 | { "processor_set_policy_control", 4007 },\ |
559 | { "processor_set_stack_usage", 4008 },\ |
560 | { "processor_set_info", 4009 } |
561 | #endif |
562 | |
563 | #ifdef __AfterMigServerHeader |
564 | __AfterMigServerHeader |
565 | #endif /* __AfterMigServerHeader */ |
566 | |
567 | #endif /* _processor_set_server_ */ |
568 | |