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
26extern "C" {
27#endif
28#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
29#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
30#endif
31 extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
32#ifdef __cplusplus
33}
34#endif
35#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
36#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
37#endif /* __has_include */
38
39/* END MIG_STRNCPY_ZEROFILL CODE */
40
41
42#ifdef AUTOTEST
43#ifndef FUNCTION_PTR_T
44#define FUNCTION_PTR_T
45typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
46typedef struct {
47 char * name;
48 function_ptr_t function;
49} function_table_entry;
50typedef function_table_entry *function_table_t;
51#endif /* FUNCTION_PTR_T */
52#endif /* AUTOTEST */
53
54#ifndef processor_set_MSG_COUNT
55#define processor_set_MSG_COUNT 11
56#endif /* processor_set_MSG_COUNT */
57
58#include <Availability.h>
59#include <mach/std_types.h>
60#include <mach/mig.h>
61#include <ipc/ipc_voucher.h>
62#include <kern/ipc_kobject.h>
63#include <kern/ipc_tt.h>
64#include <kern/ipc_host.h>
65#include <kern/ledger.h>
66#include <kern/processor.h>
67#include <kern/sync_sema.h>
68#include <ipc/ipc_eventlink.h>
69#include <vm/memory_object.h>
70#include <vm/vm_map.h>
71#include <kern/arcade.h>
72#include <kern/ipc_mig.h>
73#include <kern/task_ident.h>
74#include <kern/kern_cdata.h>
75#include <mach/mig.h>
76#include <mach/mach_types.h>
77
78#ifdef __BeforeMigServerHeader
79__BeforeMigServerHeader
80#endif /* __BeforeMigServerHeader */
81
82#ifndef MIG_SERVER_ROUTINE
83#define MIG_SERVER_ROUTINE
84#endif
85
86
87/* Routine processor_set_statistics */
88#ifdef mig_external
89mig_external
90#else
91extern
92#endif /* mig_external */
93MIG_SERVER_ROUTINE
94kern_return_t processor_set_statistics
95(
96 processor_set_name_t pset,
97 processor_set_flavor_t flavor,
98 processor_set_info_t info_out,
99 mach_msg_type_number_t *info_outCnt
100);
101
102/* Routine processor_set_tasks */
103#ifdef mig_external
104mig_external
105#else
106extern
107#endif /* mig_external */
108MIG_SERVER_ROUTINE
109kern_return_t processor_set_tasks
110(
111 processor_set_t processor_set,
112 task_array_t *task_list,
113 mach_msg_type_number_t *task_listCnt
114);
115
116/* Routine processor_set_threads */
117#ifdef mig_external
118mig_external
119#else
120extern
121#endif /* mig_external */
122MIG_SERVER_ROUTINE
123kern_return_t processor_set_threads
124(
125 processor_set_t processor_set,
126 thread_act_array_t *thread_list,
127 mach_msg_type_number_t *thread_listCnt
128);
129
130/* Routine processor_set_stack_usage */
131#ifdef mig_external
132mig_external
133#else
134extern
135#endif /* mig_external */
136MIG_SERVER_ROUTINE
137kern_return_t processor_set_stack_usage
138(
139 processor_set_t pset,
140 unsigned *ltotal,
141 vm_size_t *space,
142 vm_size_t *resident,
143 vm_size_t *maxusage,
144 vm_offset_t *maxstack
145);
146
147/* Routine processor_set_info */
148#ifdef mig_external
149mig_external
150#else
151extern
152#endif /* mig_external */
153MIG_SERVER_ROUTINE
154kern_return_t processor_set_info
155(
156 processor_set_name_t set_name,
157 int flavor,
158 host_t *host,
159 processor_set_info_t info_out,
160 mach_msg_type_number_t *info_outCnt
161);
162
163/* Routine processor_set_tasks_with_flavor */
164#ifdef mig_external
165mig_external
166#else
167extern
168#endif /* mig_external */
169MIG_SERVER_ROUTINE
170kern_return_t processor_set_tasks_with_flavor
171(
172 processor_set_t processor_set,
173 mach_task_flavor_t flavor,
174 task_array_t *task_list,
175 mach_msg_type_number_t *task_listCnt
176);
177
178#ifdef mig_external
179mig_external
180#else
181extern
182#endif /* mig_external */
183boolean_t processor_set_server(
184 mach_msg_header_t *InHeadP,
185 void *InDataP,
186 mach_msg_max_trailer_t *InTrailerP,
187 mach_msg_header_t *OutHeadP,
188 void *OutDataP);
189
190#ifdef mig_external
191mig_external
192#else
193extern
194#endif /* mig_external */
195mig_kern_routine_t processor_set_server_routine(
196 mach_msg_header_t *InHeadP);
197
198
199/* Description of this kernel subsystem, for use in direct RPC */
200extern const struct processor_set_subsystem {
201 mig_kern_server_routine_t kserver; /* Server routine */
202 mach_msg_id_t start; /* Min routine number */
203 mach_msg_id_t end; /* Max routine number + 1 */
204 unsigned int maxsize; /* Max msg size */
205 vm_address_t reserved; /* Reserved */
206 struct kern_routine_descriptor /* Array of routine descriptors */
207 kroutine[11];
208} processor_set_subsystem;
209
210/* typedefs for all requests */
211
212#ifndef __Request__processor_set_subsystem__defined
213#define __Request__processor_set_subsystem__defined
214
215#ifdef __MigPackStructs
216#pragma pack(push, 4)
217#endif
218 typedef struct {
219 mach_msg_header_t Head;
220 NDR_record_t NDR;
221 processor_set_flavor_t flavor;
222 mach_msg_type_number_t info_outCnt;
223 } __Request__processor_set_statistics_t __attribute__((unused));
224#ifdef __MigPackStructs
225#pragma pack(pop)
226#endif
227/* Struct for kernel processed data (Header + Descriptors) */
228#ifdef __MigPackStructs
229#pragma pack(push, 4)
230#endif
231 typedef struct {
232 mach_msg_header_t Head;
233 } __RequestKData__processor_set_statistics_t __attribute__((unused));
234#ifdef __MigPackStructs
235#pragma pack(pop)
236#endif
237/* Struct for pure user data */
238#ifdef __MigPackStructs
239#pragma pack(push, 4)
240#endif
241 typedef struct {
242 NDR_record_t NDR;
243 processor_set_flavor_t flavor;
244 mach_msg_type_number_t info_outCnt;
245 char padding[0]; /* Avoid generating empty UData structs */
246 } __RequestUData__processor_set_statistics_t __attribute__((unused));
247#ifdef __MigPackStructs
248#pragma pack(pop)
249#endif
250
251#ifdef __MigPackStructs
252#pragma pack(push, 4)
253#endif
254 typedef struct {
255 mach_msg_header_t Head;
256 } __Request__processor_set_tasks_t __attribute__((unused));
257#ifdef __MigPackStructs
258#pragma pack(pop)
259#endif
260/* Struct for kernel processed data (Header + Descriptors) */
261#ifdef __MigPackStructs
262#pragma pack(push, 4)
263#endif
264 typedef struct {
265 mach_msg_header_t Head;
266 } __RequestKData__processor_set_tasks_t __attribute__((unused));
267#ifdef __MigPackStructs
268#pragma pack(pop)
269#endif
270/* Struct for pure user data */
271#ifdef __MigPackStructs
272#pragma pack(push, 4)
273#endif
274 typedef struct {
275 char padding[0]; /* Avoid generating empty UData structs */
276 } __RequestUData__processor_set_tasks_t __attribute__((unused));
277#ifdef __MigPackStructs
278#pragma pack(pop)
279#endif
280
281#ifdef __MigPackStructs
282#pragma pack(push, 4)
283#endif
284 typedef struct {
285 mach_msg_header_t Head;
286 } __Request__processor_set_threads_t __attribute__((unused));
287#ifdef __MigPackStructs
288#pragma pack(pop)
289#endif
290/* Struct for kernel processed data (Header + Descriptors) */
291#ifdef __MigPackStructs
292#pragma pack(push, 4)
293#endif
294 typedef struct {
295 mach_msg_header_t Head;
296 } __RequestKData__processor_set_threads_t __attribute__((unused));
297#ifdef __MigPackStructs
298#pragma pack(pop)
299#endif
300/* Struct for pure user data */
301#ifdef __MigPackStructs
302#pragma pack(push, 4)
303#endif
304 typedef struct {
305 char padding[0]; /* Avoid generating empty UData structs */
306 } __RequestUData__processor_set_threads_t __attribute__((unused));
307#ifdef __MigPackStructs
308#pragma pack(pop)
309#endif
310
311#ifdef __MigPackStructs
312#pragma pack(push, 4)
313#endif
314 typedef struct {
315 mach_msg_header_t Head;
316 } __Request__processor_set_stack_usage_t __attribute__((unused));
317#ifdef __MigPackStructs
318#pragma pack(pop)
319#endif
320/* Struct for kernel processed data (Header + Descriptors) */
321#ifdef __MigPackStructs
322#pragma pack(push, 4)
323#endif
324 typedef struct {
325 mach_msg_header_t Head;
326 } __RequestKData__processor_set_stack_usage_t __attribute__((unused));
327#ifdef __MigPackStructs
328#pragma pack(pop)
329#endif
330/* Struct for pure user data */
331#ifdef __MigPackStructs
332#pragma pack(push, 4)
333#endif
334 typedef struct {
335 char padding[0]; /* Avoid generating empty UData structs */
336 } __RequestUData__processor_set_stack_usage_t __attribute__((unused));
337#ifdef __MigPackStructs
338#pragma pack(pop)
339#endif
340
341#ifdef __MigPackStructs
342#pragma pack(push, 4)
343#endif
344 typedef struct {
345 mach_msg_header_t Head;
346 NDR_record_t NDR;
347 int flavor;
348 mach_msg_type_number_t info_outCnt;
349 } __Request__processor_set_info_t __attribute__((unused));
350#ifdef __MigPackStructs
351#pragma pack(pop)
352#endif
353/* Struct for kernel processed data (Header + Descriptors) */
354#ifdef __MigPackStructs
355#pragma pack(push, 4)
356#endif
357 typedef struct {
358 mach_msg_header_t Head;
359 } __RequestKData__processor_set_info_t __attribute__((unused));
360#ifdef __MigPackStructs
361#pragma pack(pop)
362#endif
363/* Struct for pure user data */
364#ifdef __MigPackStructs
365#pragma pack(push, 4)
366#endif
367 typedef struct {
368 NDR_record_t NDR;
369 int flavor;
370 mach_msg_type_number_t info_outCnt;
371 char padding[0]; /* Avoid generating empty UData structs */
372 } __RequestUData__processor_set_info_t __attribute__((unused));
373#ifdef __MigPackStructs
374#pragma pack(pop)
375#endif
376
377#ifdef __MigPackStructs
378#pragma pack(push, 4)
379#endif
380 typedef struct {
381 mach_msg_header_t Head;
382 NDR_record_t NDR;
383 mach_task_flavor_t flavor;
384 } __Request__processor_set_tasks_with_flavor_t __attribute__((unused));
385#ifdef __MigPackStructs
386#pragma pack(pop)
387#endif
388/* Struct for kernel processed data (Header + Descriptors) */
389#ifdef __MigPackStructs
390#pragma pack(push, 4)
391#endif
392 typedef struct {
393 mach_msg_header_t Head;
394 } __RequestKData__processor_set_tasks_with_flavor_t __attribute__((unused));
395#ifdef __MigPackStructs
396#pragma pack(pop)
397#endif
398/* Struct for pure user data */
399#ifdef __MigPackStructs
400#pragma pack(push, 4)
401#endif
402 typedef struct {
403 NDR_record_t NDR;
404 mach_task_flavor_t flavor;
405 char padding[0]; /* Avoid generating empty UData structs */
406 } __RequestUData__processor_set_tasks_with_flavor_t __attribute__((unused));
407#ifdef __MigPackStructs
408#pragma pack(pop)
409#endif
410#endif /* !__Request__processor_set_subsystem__defined */
411
412
413/* union of all requests */
414
415#ifndef __RequestUnion__processor_set_subsystem__defined
416#define __RequestUnion__processor_set_subsystem__defined
417union __RequestUnion__processor_set_subsystem {
418 __Request__processor_set_statistics_t Request_processor_set_statistics;
419 __Request__processor_set_tasks_t Request_processor_set_tasks;
420 __Request__processor_set_threads_t Request_processor_set_threads;
421 __Request__processor_set_stack_usage_t Request_processor_set_stack_usage;
422 __Request__processor_set_info_t Request_processor_set_info;
423 __Request__processor_set_tasks_with_flavor_t Request_processor_set_tasks_with_flavor;
424};
425#endif /* __RequestUnion__processor_set_subsystem__defined */
426/* typedefs for all replies */
427
428#ifndef __Reply__processor_set_subsystem__defined
429#define __Reply__processor_set_subsystem__defined
430
431#ifdef __MigPackStructs
432#pragma pack(push, 4)
433#endif
434 typedef struct {
435 mach_msg_header_t Head;
436 NDR_record_t NDR;
437 kern_return_t RetCode;
438 mach_msg_type_number_t info_outCnt;
439 integer_t info_out[5];
440 } __Reply__processor_set_statistics_t __attribute__((unused));
441#ifdef __MigPackStructs
442#pragma pack(pop)
443#endif
444/* Struct for kernel processed data (Header + Descriptors) */
445#ifdef __MigPackStructs
446#pragma pack(push, 4)
447#endif
448 typedef struct {
449 mach_msg_header_t Head;
450 } __ReplyKData__processor_set_statistics_t __attribute__((unused));
451#ifdef __MigPackStructs
452#pragma pack(pop)
453#endif
454/* Struct for pure user data */
455#ifdef __MigPackStructs
456#pragma pack(push, 4)
457#endif
458 typedef struct {
459 NDR_record_t NDR;
460 kern_return_t RetCode;
461 mach_msg_type_number_t info_outCnt;
462 integer_t info_out[5];
463 char padding[0]; /* Avoid generating empty UData structs */
464 } __ReplyUData__processor_set_statistics_t __attribute__((unused));
465#ifdef __MigPackStructs
466#pragma pack(pop)
467#endif
468
469#ifdef __MigPackStructs
470#pragma pack(push, 4)
471#endif
472 typedef struct {
473 mach_msg_header_t Head;
474 /* start of the kernel processed data */
475 mach_msg_body_t msgh_body;
476 mach_msg_ool_ports_descriptor_t task_list;
477 /* end of the kernel processed data */
478 NDR_record_t NDR;
479 mach_msg_type_number_t task_listCnt;
480 } __Reply__processor_set_tasks_t __attribute__((unused));
481#ifdef __MigPackStructs
482#pragma pack(pop)
483#endif
484/* Struct for kernel processed data (Header + Descriptors) */
485#ifdef __MigPackStructs
486#pragma pack(push, 4)
487#endif
488 typedef struct {
489 mach_msg_header_t Head;
490 mach_msg_body_t msgh_body;
491 mach_msg_ool_ports_descriptor_t task_list;
492 } __ReplyKData__processor_set_tasks_t __attribute__((unused));
493#ifdef __MigPackStructs
494#pragma pack(pop)
495#endif
496/* Struct for pure user data */
497#ifdef __MigPackStructs
498#pragma pack(push, 4)
499#endif
500 typedef struct {
501 NDR_record_t NDR;
502 mach_msg_type_number_t task_listCnt;
503 char padding[0]; /* Avoid generating empty UData structs */
504 } __ReplyUData__processor_set_tasks_t __attribute__((unused));
505#ifdef __MigPackStructs
506#pragma pack(pop)
507#endif
508
509#ifdef __MigPackStructs
510#pragma pack(push, 4)
511#endif
512 typedef struct {
513 mach_msg_header_t Head;
514 /* start of the kernel processed data */
515 mach_msg_body_t msgh_body;
516 mach_msg_ool_ports_descriptor_t thread_list;
517 /* end of the kernel processed data */
518 NDR_record_t NDR;
519 mach_msg_type_number_t thread_listCnt;
520 } __Reply__processor_set_threads_t __attribute__((unused));
521#ifdef __MigPackStructs
522#pragma pack(pop)
523#endif
524/* Struct for kernel processed data (Header + Descriptors) */
525#ifdef __MigPackStructs
526#pragma pack(push, 4)
527#endif
528 typedef struct {
529 mach_msg_header_t Head;
530 mach_msg_body_t msgh_body;
531 mach_msg_ool_ports_descriptor_t thread_list;
532 } __ReplyKData__processor_set_threads_t __attribute__((unused));
533#ifdef __MigPackStructs
534#pragma pack(pop)
535#endif
536/* Struct for pure user data */
537#ifdef __MigPackStructs
538#pragma pack(push, 4)
539#endif
540 typedef struct {
541 NDR_record_t NDR;
542 mach_msg_type_number_t thread_listCnt;
543 char padding[0]; /* Avoid generating empty UData structs */
544 } __ReplyUData__processor_set_threads_t __attribute__((unused));
545#ifdef __MigPackStructs
546#pragma pack(pop)
547#endif
548
549#ifdef __MigPackStructs
550#pragma pack(push, 4)
551#endif
552 typedef struct {
553 mach_msg_header_t Head;
554 NDR_record_t NDR;
555 kern_return_t RetCode;
556 unsigned ltotal;
557 vm_size_t space;
558 vm_size_t resident;
559 vm_size_t maxusage;
560 vm_offset_t maxstack;
561 } __Reply__processor_set_stack_usage_t __attribute__((unused));
562#ifdef __MigPackStructs
563#pragma pack(pop)
564#endif
565/* Struct for kernel processed data (Header + Descriptors) */
566#ifdef __MigPackStructs
567#pragma pack(push, 4)
568#endif
569 typedef struct {
570 mach_msg_header_t Head;
571 } __ReplyKData__processor_set_stack_usage_t __attribute__((unused));
572#ifdef __MigPackStructs
573#pragma pack(pop)
574#endif
575/* Struct for pure user data */
576#ifdef __MigPackStructs
577#pragma pack(push, 4)
578#endif
579 typedef struct {
580 NDR_record_t NDR;
581 kern_return_t RetCode;
582 unsigned ltotal;
583 vm_size_t space;
584 vm_size_t resident;
585 vm_size_t maxusage;
586 vm_offset_t maxstack;
587 char padding[0]; /* Avoid generating empty UData structs */
588 } __ReplyUData__processor_set_stack_usage_t __attribute__((unused));
589#ifdef __MigPackStructs
590#pragma pack(pop)
591#endif
592
593#ifdef __MigPackStructs
594#pragma pack(push, 4)
595#endif
596 typedef struct {
597 mach_msg_header_t Head;
598 /* start of the kernel processed data */
599 mach_msg_body_t msgh_body;
600 mach_msg_port_descriptor_t host;
601 /* end of the kernel processed data */
602 NDR_record_t NDR;
603 mach_msg_type_number_t info_outCnt;
604 integer_t info_out[5];
605 } __Reply__processor_set_info_t __attribute__((unused));
606#ifdef __MigPackStructs
607#pragma pack(pop)
608#endif
609/* Struct for kernel processed data (Header + Descriptors) */
610#ifdef __MigPackStructs
611#pragma pack(push, 4)
612#endif
613 typedef struct {
614 mach_msg_header_t Head;
615 mach_msg_body_t msgh_body;
616 mach_msg_port_descriptor_t host;
617 } __ReplyKData__processor_set_info_t __attribute__((unused));
618#ifdef __MigPackStructs
619#pragma pack(pop)
620#endif
621/* Struct for pure user data */
622#ifdef __MigPackStructs
623#pragma pack(push, 4)
624#endif
625 typedef struct {
626 NDR_record_t NDR;
627 mach_msg_type_number_t info_outCnt;
628 integer_t info_out[5];
629 char padding[0]; /* Avoid generating empty UData structs */
630 } __ReplyUData__processor_set_info_t __attribute__((unused));
631#ifdef __MigPackStructs
632#pragma pack(pop)
633#endif
634
635#ifdef __MigPackStructs
636#pragma pack(push, 4)
637#endif
638 typedef struct {
639 mach_msg_header_t Head;
640 /* start of the kernel processed data */
641 mach_msg_body_t msgh_body;
642 mach_msg_ool_ports_descriptor_t task_list;
643 /* end of the kernel processed data */
644 NDR_record_t NDR;
645 mach_msg_type_number_t task_listCnt;
646 } __Reply__processor_set_tasks_with_flavor_t __attribute__((unused));
647#ifdef __MigPackStructs
648#pragma pack(pop)
649#endif
650/* Struct for kernel processed data (Header + Descriptors) */
651#ifdef __MigPackStructs
652#pragma pack(push, 4)
653#endif
654 typedef struct {
655 mach_msg_header_t Head;
656 mach_msg_body_t msgh_body;
657 mach_msg_ool_ports_descriptor_t task_list;
658 } __ReplyKData__processor_set_tasks_with_flavor_t __attribute__((unused));
659#ifdef __MigPackStructs
660#pragma pack(pop)
661#endif
662/* Struct for pure user data */
663#ifdef __MigPackStructs
664#pragma pack(push, 4)
665#endif
666 typedef struct {
667 NDR_record_t NDR;
668 mach_msg_type_number_t task_listCnt;
669 char padding[0]; /* Avoid generating empty UData structs */
670 } __ReplyUData__processor_set_tasks_with_flavor_t __attribute__((unused));
671#ifdef __MigPackStructs
672#pragma pack(pop)
673#endif
674#endif /* !__Reply__processor_set_subsystem__defined */
675
676
677/* union of all replies */
678
679#ifndef __ReplyUnion__processor_set_subsystem__defined
680#define __ReplyUnion__processor_set_subsystem__defined
681union __ReplyUnion__processor_set_subsystem {
682 __Reply__processor_set_statistics_t Reply_processor_set_statistics;
683 __Reply__processor_set_tasks_t Reply_processor_set_tasks;
684 __Reply__processor_set_threads_t Reply_processor_set_threads;
685 __Reply__processor_set_stack_usage_t Reply_processor_set_stack_usage;
686 __Reply__processor_set_info_t Reply_processor_set_info;
687 __Reply__processor_set_tasks_with_flavor_t Reply_processor_set_tasks_with_flavor;
688};
689#endif /* __ReplyUnion__processor_set_subsystem__defined */
690
691#ifndef subsystem_to_name_map_processor_set
692#define subsystem_to_name_map_processor_set \
693 { "processor_set_statistics", 4000 },\
694 { "processor_set_tasks", 4005 },\
695 { "processor_set_threads", 4006 },\
696 { "processor_set_stack_usage", 4008 },\
697 { "processor_set_info", 4009 },\
698 { "processor_set_tasks_with_flavor", 4010 }
699#endif
700
701#ifdef __AfterMigServerHeader
702__AfterMigServerHeader
703#endif /* __AfterMigServerHeader */
704
705#endif /* _processor_set_server_ */
706