1/*
2 * IDENTIFICATION:
3 * stub generated by bootstrap_cmds-133
4 * OPTIONS:
5 * KernelUser
6 */
7#define __MIG_check__Reply__task_access_subsystem__ 1
8
9#include "task_access.h"
10
11/* TODO: #include <mach/mach.h> */
12#ifdef __cplusplus
13extern "C" {
14#endif /* __cplusplus */
15extern void mach_msg_destroy(mach_msg_header_t *);
16#ifdef __cplusplus
17}
18#endif /* __cplusplus */
19
20#ifndef mig_internal
21#define mig_internal static __inline__
22#endif /* mig_internal */
23
24#ifndef mig_external
25#define mig_external
26#endif /* mig_external */
27
28#if !defined(__MigTypeCheck) && defined(TypeCheck)
29#define __MigTypeCheck TypeCheck /* Legacy setting */
30#endif /* !defined(__MigTypeCheck) */
31
32#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_)
33#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */
34#endif /* !defined(__MigKernelSpecificCode) */
35
36#ifndef LimitCheck
37#define LimitCheck 0
38#endif /* LimitCheck */
39
40#ifndef min
41#define min(a,b) ( ((a) < (b))? (a): (b) )
42#endif /* min */
43
44#if !defined(_WALIGN_)
45#define _WALIGN_(x) (((x) + 3) & ~3)
46#endif /* !defined(_WALIGN_) */
47
48#if !defined(_WALIGNSZ_)
49#define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
50#endif /* !defined(_WALIGNSZ_) */
51
52#ifndef UseStaticTemplates
53#define UseStaticTemplates 0
54#endif /* UseStaticTemplates */
55
56#ifndef MIG_SERVER_ROUTINE
57#define MIG_SERVER_ROUTINE
58#endif
59
60#ifndef __MachMsgErrorWithTimeout
61#define __MachMsgErrorWithTimeout(_R_) { \
62 switch (_R_) { \
63 case MACH_SEND_INVALID_DATA: \
64 case MACH_SEND_INVALID_DEST: \
65 case MACH_SEND_INVALID_HEADER: \
66 mig_put_reply_port(InP->Head.msgh_reply_port); \
67 break; \
68 case MACH_SEND_TIMED_OUT: \
69 case MACH_RCV_TIMED_OUT: \
70 default: \
71 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
72 } \
73}
74#endif /* __MachMsgErrorWithTimeout */
75
76#ifndef __MachMsgErrorWithoutTimeout
77#define __MachMsgErrorWithoutTimeout(_R_) { \
78 switch (_R_) { \
79 case MACH_SEND_INVALID_DATA: \
80 case MACH_SEND_INVALID_DEST: \
81 case MACH_SEND_INVALID_HEADER: \
82 mig_put_reply_port(InP->Head.msgh_reply_port); \
83 break; \
84 default: \
85 mig_dealloc_reply_port(InP->Head.msgh_reply_port); \
86 } \
87}
88#endif /* __MachMsgErrorWithoutTimeout */
89
90#ifndef __DeclareSendRpc
91#define __DeclareSendRpc(_NUM_, _NAME_)
92#endif /* __DeclareSendRpc */
93
94#ifndef __BeforeSendRpc
95#define __BeforeSendRpc(_NUM_, _NAME_)
96#endif /* __BeforeSendRpc */
97
98#ifndef __AfterSendRpc
99#define __AfterSendRpc(_NUM_, _NAME_)
100#endif /* __AfterSendRpc */
101
102#ifndef __DeclareSendSimple
103#define __DeclareSendSimple(_NUM_, _NAME_)
104#endif /* __DeclareSendSimple */
105
106#ifndef __BeforeSendSimple
107#define __BeforeSendSimple(_NUM_, _NAME_)
108#endif /* __BeforeSendSimple */
109
110#ifndef __AfterSendSimple
111#define __AfterSendSimple(_NUM_, _NAME_)
112#endif /* __AfterSendSimple */
113
114#define msgh_request_port msgh_remote_port
115#define msgh_reply_port msgh_local_port
116
117
118
119#if ( __MigTypeCheck )
120#if __MIG_check__Reply__task_access_subsystem__
121#if !defined(__MIG_check__Reply__check_task_access_t__defined)
122#define __MIG_check__Reply__check_task_access_t__defined
123
124mig_internal kern_return_t __MIG_check__Reply__check_task_access_t(__Reply__check_task_access_t *Out0P)
125{
126
127 typedef __Reply__check_task_access_t __Reply __attribute__((unused));
128 if (Out0P->Head.msgh_id != 27100) {
129 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
130 { return MIG_SERVER_DIED; }
131 else
132 { return MIG_REPLY_MISMATCH; }
133 }
134
135#if __MigTypeCheck
136 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
137 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
138 { return MIG_TYPE_ERROR ; }
139#endif /* __MigTypeCheck */
140
141#if __MigTypeCheck
142 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
143 return MIG_TYPE_ERROR;
144 }
145#endif /* __MigTypeCheck */
146 {
147 return Out0P->RetCode;
148 }
149}
150#endif /* !defined(__MIG_check__Reply__check_task_access_t__defined) */
151#endif /* __MIG_check__Reply__task_access_subsystem__ */
152#endif /* ( __MigTypeCheck ) */
153
154
155/* Routine check_task_access */
156mig_external kern_return_t check_task_access
157(
158 mach_port_t task_access_port,
159 int32_t calling_pid,
160 uint32_t calling_gid,
161 int32_t target_pid
162)
163{
164
165#ifdef __MigPackStructs
166#pragma pack(push, 4)
167#endif
168 typedef struct {
169 mach_msg_header_t Head;
170 NDR_record_t NDR;
171 int32_t calling_pid;
172 uint32_t calling_gid;
173 int32_t target_pid;
174 } Request __attribute__((unused));
175#ifdef __MigPackStructs
176#pragma pack(pop)
177#endif
178
179#ifdef __MigPackStructs
180#pragma pack(push, 4)
181#endif
182 typedef struct {
183 mach_msg_header_t Head;
184 NDR_record_t NDR;
185 kern_return_t RetCode;
186 mach_msg_trailer_t trailer;
187 } Reply __attribute__((unused));
188#ifdef __MigPackStructs
189#pragma pack(pop)
190#endif
191
192#ifdef __MigPackStructs
193#pragma pack(push, 4)
194#endif
195 typedef struct {
196 mach_msg_header_t Head;
197 NDR_record_t NDR;
198 kern_return_t RetCode;
199 } __Reply __attribute__((unused));
200#ifdef __MigPackStructs
201#pragma pack(pop)
202#endif
203 /*
204 * typedef struct {
205 * mach_msg_header_t Head;
206 * NDR_record_t NDR;
207 * kern_return_t RetCode;
208 * } mig_reply_error_t;
209 */
210
211 union {
212 Request In;
213 Reply Out;
214 } Mess;
215
216 Request *InP = &Mess.In;
217 Reply *Out0P = &Mess.Out;
218
219 mach_msg_return_t msg_result;
220
221#ifdef __MIG_check__Reply__check_task_access_t__defined
222 kern_return_t check_result;
223#endif /* __MIG_check__Reply__check_task_access_t__defined */
224
225 __DeclareSendRpc(27000, "check_task_access")
226
227 InP->NDR = NDR_record;
228
229 InP->calling_pid = calling_pid;
230
231 InP->calling_gid = calling_gid;
232
233 InP->target_pid = target_pid;
234
235 InP->Head.msgh_reply_port = mig_get_reply_port();
236 InP->Head.msgh_bits =
237 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
238 /* msgh_size passed as argument */
239 InP->Head.msgh_request_port = task_access_port;
240 InP->Head.msgh_id = 27000;
241 InP->Head.msgh_reserved = 0;
242
243 __BeforeSendRpc(27000, "check_task_access")
244#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
245 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request), rcv_size: (mach_msg_size_t)sizeof(Reply));
246#else
247 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
248#endif /* __MigKernelSpecificCode */
249 __AfterSendRpc(27000, "check_task_access")
250 if (msg_result != MACH_MSG_SUCCESS) {
251 __MachMsgErrorWithoutTimeout(msg_result);
252 }
253 if (msg_result != MACH_MSG_SUCCESS) {
254 { return msg_result; }
255 }
256
257
258#if defined(__MIG_check__Reply__check_task_access_t__defined)
259 check_result = __MIG_check__Reply__check_task_access_t(Out0P: (__Reply__check_task_access_t *)Out0P);
260 if (check_result != MACH_MSG_SUCCESS) {
261#if __MigKernelSpecificCode
262 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
263#endif /* __MigKernelSpecificCode */
264 { return check_result; }
265 }
266#endif /* defined(__MIG_check__Reply__check_task_access_t__defined) */
267
268 return KERN_SUCCESS;
269}
270
271#if ( __MigTypeCheck )
272#if __MIG_check__Reply__task_access_subsystem__
273#if !defined(__MIG_check__Reply__find_code_signature_t__defined)
274#define __MIG_check__Reply__find_code_signature_t__defined
275
276mig_internal kern_return_t __MIG_check__Reply__find_code_signature_t(__Reply__find_code_signature_t *Out0P)
277{
278
279 typedef __Reply__find_code_signature_t __Reply __attribute__((unused));
280 if (Out0P->Head.msgh_id != 27101) {
281 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
282 { return MIG_SERVER_DIED; }
283 else
284 { return MIG_REPLY_MISMATCH; }
285 }
286
287#if __MigTypeCheck
288 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
289 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
290 { return MIG_TYPE_ERROR ; }
291#endif /* __MigTypeCheck */
292
293#if __MigTypeCheck
294 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
295 return MIG_TYPE_ERROR;
296 }
297#endif /* __MigTypeCheck */
298 {
299 return Out0P->RetCode;
300 }
301}
302#endif /* !defined(__MIG_check__Reply__find_code_signature_t__defined) */
303#endif /* __MIG_check__Reply__task_access_subsystem__ */
304#endif /* ( __MigTypeCheck ) */
305
306
307/* Routine find_code_signature */
308mig_external kern_return_t find_code_signature
309(
310 mach_port_t task_access_port,
311 int32_t new_pid
312)
313{
314
315#ifdef __MigPackStructs
316#pragma pack(push, 4)
317#endif
318 typedef struct {
319 mach_msg_header_t Head;
320 NDR_record_t NDR;
321 int32_t new_pid;
322 } Request __attribute__((unused));
323#ifdef __MigPackStructs
324#pragma pack(pop)
325#endif
326
327#ifdef __MigPackStructs
328#pragma pack(push, 4)
329#endif
330 typedef struct {
331 mach_msg_header_t Head;
332 NDR_record_t NDR;
333 kern_return_t RetCode;
334 mach_msg_trailer_t trailer;
335 } Reply __attribute__((unused));
336#ifdef __MigPackStructs
337#pragma pack(pop)
338#endif
339
340#ifdef __MigPackStructs
341#pragma pack(push, 4)
342#endif
343 typedef struct {
344 mach_msg_header_t Head;
345 NDR_record_t NDR;
346 kern_return_t RetCode;
347 } __Reply __attribute__((unused));
348#ifdef __MigPackStructs
349#pragma pack(pop)
350#endif
351 /*
352 * typedef struct {
353 * mach_msg_header_t Head;
354 * NDR_record_t NDR;
355 * kern_return_t RetCode;
356 * } mig_reply_error_t;
357 */
358
359 union {
360 Request In;
361 Reply Out;
362 } Mess;
363
364 Request *InP = &Mess.In;
365 Reply *Out0P = &Mess.Out;
366
367 mach_msg_return_t msg_result;
368
369#ifdef __MIG_check__Reply__find_code_signature_t__defined
370 kern_return_t check_result;
371#endif /* __MIG_check__Reply__find_code_signature_t__defined */
372
373 __DeclareSendRpc(27001, "find_code_signature")
374
375 InP->NDR = NDR_record;
376
377 InP->new_pid = new_pid;
378
379 InP->Head.msgh_reply_port = mig_get_reply_port();
380 InP->Head.msgh_bits =
381 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
382 /* msgh_size passed as argument */
383 InP->Head.msgh_request_port = task_access_port;
384 InP->Head.msgh_id = 27001;
385 InP->Head.msgh_reserved = 0;
386
387 __BeforeSendRpc(27001, "find_code_signature")
388#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
389 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request), rcv_size: (mach_msg_size_t)sizeof(Reply));
390#else
391 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
392#endif /* __MigKernelSpecificCode */
393 __AfterSendRpc(27001, "find_code_signature")
394 if (msg_result != MACH_MSG_SUCCESS) {
395 __MachMsgErrorWithoutTimeout(msg_result);
396 }
397 if (msg_result != MACH_MSG_SUCCESS) {
398 { return msg_result; }
399 }
400
401
402#if defined(__MIG_check__Reply__find_code_signature_t__defined)
403 check_result = __MIG_check__Reply__find_code_signature_t(Out0P: (__Reply__find_code_signature_t *)Out0P);
404 if (check_result != MACH_MSG_SUCCESS) {
405#if __MigKernelSpecificCode
406 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
407#endif /* __MigKernelSpecificCode */
408 { return check_result; }
409 }
410#endif /* defined(__MIG_check__Reply__find_code_signature_t__defined) */
411
412 return KERN_SUCCESS;
413}
414
415#if ( __MigTypeCheck )
416#if __MIG_check__Reply__task_access_subsystem__
417#if !defined(__MIG_check__Reply__check_task_access_with_flavor_t__defined)
418#define __MIG_check__Reply__check_task_access_with_flavor_t__defined
419
420mig_internal kern_return_t __MIG_check__Reply__check_task_access_with_flavor_t(__Reply__check_task_access_with_flavor_t *Out0P)
421{
422
423 typedef __Reply__check_task_access_with_flavor_t __Reply __attribute__((unused));
424 if (Out0P->Head.msgh_id != 27102) {
425 if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE)
426 { return MIG_SERVER_DIED; }
427 else
428 { return MIG_REPLY_MISMATCH; }
429 }
430
431#if __MigTypeCheck
432 if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) ||
433 (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply)))
434 { return MIG_TYPE_ERROR ; }
435#endif /* __MigTypeCheck */
436
437#if __MigTypeCheck
438 if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) {
439 return MIG_TYPE_ERROR;
440 }
441#endif /* __MigTypeCheck */
442 {
443 return Out0P->RetCode;
444 }
445}
446#endif /* !defined(__MIG_check__Reply__check_task_access_with_flavor_t__defined) */
447#endif /* __MIG_check__Reply__task_access_subsystem__ */
448#endif /* ( __MigTypeCheck ) */
449
450
451/* Routine check_task_access_with_flavor */
452mig_external kern_return_t check_task_access_with_flavor
453(
454 mach_port_t task_access_port,
455 int32_t calling_pid,
456 uint32_t calling_gid,
457 int32_t target_pid,
458 mach_task_flavor_t flavor
459)
460{
461
462#ifdef __MigPackStructs
463#pragma pack(push, 4)
464#endif
465 typedef struct {
466 mach_msg_header_t Head;
467 NDR_record_t NDR;
468 int32_t calling_pid;
469 uint32_t calling_gid;
470 int32_t target_pid;
471 mach_task_flavor_t flavor;
472 } Request __attribute__((unused));
473#ifdef __MigPackStructs
474#pragma pack(pop)
475#endif
476
477#ifdef __MigPackStructs
478#pragma pack(push, 4)
479#endif
480 typedef struct {
481 mach_msg_header_t Head;
482 NDR_record_t NDR;
483 kern_return_t RetCode;
484 mach_msg_trailer_t trailer;
485 } Reply __attribute__((unused));
486#ifdef __MigPackStructs
487#pragma pack(pop)
488#endif
489
490#ifdef __MigPackStructs
491#pragma pack(push, 4)
492#endif
493 typedef struct {
494 mach_msg_header_t Head;
495 NDR_record_t NDR;
496 kern_return_t RetCode;
497 } __Reply __attribute__((unused));
498#ifdef __MigPackStructs
499#pragma pack(pop)
500#endif
501 /*
502 * typedef struct {
503 * mach_msg_header_t Head;
504 * NDR_record_t NDR;
505 * kern_return_t RetCode;
506 * } mig_reply_error_t;
507 */
508
509 union {
510 Request In;
511 Reply Out;
512 } Mess;
513
514 Request *InP = &Mess.In;
515 Reply *Out0P = &Mess.Out;
516
517 mach_msg_return_t msg_result;
518
519#ifdef __MIG_check__Reply__check_task_access_with_flavor_t__defined
520 kern_return_t check_result;
521#endif /* __MIG_check__Reply__check_task_access_with_flavor_t__defined */
522
523 __DeclareSendRpc(27002, "check_task_access_with_flavor")
524
525 InP->NDR = NDR_record;
526
527 InP->calling_pid = calling_pid;
528
529 InP->calling_gid = calling_gid;
530
531 InP->target_pid = target_pid;
532
533 InP->flavor = flavor;
534
535 InP->Head.msgh_reply_port = mig_get_reply_port();
536 InP->Head.msgh_bits =
537 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
538 /* msgh_size passed as argument */
539 InP->Head.msgh_request_port = task_access_port;
540 InP->Head.msgh_id = 27002;
541 InP->Head.msgh_reserved = 0;
542
543 __BeforeSendRpc(27002, "check_task_access_with_flavor")
544#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
545 msg_result = mach_msg_rpc_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request), rcv_size: (mach_msg_size_t)sizeof(Reply));
546#else
547 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_RCV_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), (mach_msg_size_t)sizeof(Reply), InP->Head.msgh_reply_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
548#endif /* __MigKernelSpecificCode */
549 __AfterSendRpc(27002, "check_task_access_with_flavor")
550 if (msg_result != MACH_MSG_SUCCESS) {
551 __MachMsgErrorWithoutTimeout(msg_result);
552 }
553 if (msg_result != MACH_MSG_SUCCESS) {
554 { return msg_result; }
555 }
556
557
558#if defined(__MIG_check__Reply__check_task_access_with_flavor_t__defined)
559 check_result = __MIG_check__Reply__check_task_access_with_flavor_t(Out0P: (__Reply__check_task_access_with_flavor_t *)Out0P);
560 if (check_result != MACH_MSG_SUCCESS) {
561#if __MigKernelSpecificCode
562 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
563#endif /* __MigKernelSpecificCode */
564 { return check_result; }
565 }
566#endif /* defined(__MIG_check__Reply__check_task_access_with_flavor_t__defined) */
567
568 return KERN_SUCCESS;
569}
570