2 * Copyright (c) 2001-2002,2004,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * stub generated Fri Mar 1 18:02:22 2002
26 * with a MiG generated Thu Feb 21 15:16:47 PST 2002 by root@blur
34 #include <mach/boolean.h>
35 #include <mach/kern_return.h>
36 #include <mach/notify.h>
37 #include <mach/mach_types.h>
38 #include <mach/message.h>
39 #include <mach/mig_errors.h>
40 #include <mach/port.h>
42 #include <mach/std_types.h>
46 #define mig_internal static
47 #endif /* mig_internal */
51 #endif /* mig_external */
55 #endif /* TypeCheck */
59 #endif /* LimitCheck */
62 #define min(a,b) ( ((a) < (b))? (a): (b) )
65 #ifndef UseStaticTemplates
66 #define UseStaticTemplates 1
67 #endif /* UseStaticTemplates */
69 #define _WALIGN_(x) (((x) + 3) & ~3)
70 #define _WALIGNSZ_(x) _WALIGN_(sizeof(x))
71 #ifndef __DeclareRcvRpc
72 #define __DeclareRcvRpc(_NUM_, _NAME_)
73 #endif /* __DeclareRcvRpc */
75 #ifndef __BeforeRcvRpc
76 #define __BeforeRcvRpc(_NUM_, _NAME_)
77 #endif /* __BeforeRcvRpc */
80 #define __AfterRcvRpc(_NUM_, _NAME_)
81 #endif /* __AfterRcvRpc */
83 #ifndef __DeclareRcvSimple
84 #define __DeclareRcvSimple(_NUM_, _NAME_)
85 #endif /* __DeclareRcvSimple */
87 #ifndef __BeforeRcvSimple
88 #define __BeforeRcvSimple(_NUM_, _NAME_)
89 #endif /* __BeforeRcvSimple */
91 #ifndef __AfterRcvSimple
92 #define __AfterRcvSimple(_NUM_, _NAME_)
93 #endif /* __AfterRcvSimple */
97 #define msgh_request_port msgh_local_port
98 #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits)
99 #define msgh_reply_port msgh_remote_port
100 #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits)
102 #define MIG_RETURN_ERROR(X, code) {\
103 ((mig_reply_error_t *)X)->RetCode = code;\
104 ((mig_reply_error_t *)X)->NDR = NDR_record;\
108 /* typedefs for all requests */
111 mach_msg_header_t Head
;
113 mach_port_name_t name
;
114 } __Request__mach_notify_port_deleted_t
;
117 mach_msg_header_t Head
;
118 /* start of the kernel processed data */
119 mach_msg_body_t msgh_body
;
120 mach_msg_port_descriptor_t rights
;
121 /* end of the kernel processed data */
122 } __Request__mach_notify_port_destroyed_t
;
125 mach_msg_header_t Head
;
127 mach_port_mscount_t mscount
;
128 } __Request__mach_notify_no_senders_t
;
131 mach_msg_header_t Head
;
132 } __Request__mach_notify_send_once_t
;
135 mach_msg_header_t Head
;
137 mach_port_name_t name
;
138 } __Request__mach_notify_dead_name_t
;
141 /* typedefs for all replies */
144 mach_msg_header_t Head
;
146 kern_return_t RetCode
;
147 } __Reply__mach_notify_port_deleted_t
;
150 mach_msg_header_t Head
;
152 kern_return_t RetCode
;
153 } __Reply__mach_notify_port_destroyed_t
;
156 mach_msg_header_t Head
;
158 kern_return_t RetCode
;
159 } __Reply__mach_notify_no_senders_t
;
162 mach_msg_header_t Head
;
164 kern_return_t RetCode
;
165 } __Reply__mach_notify_send_once_t
;
168 mach_msg_header_t Head
;
170 kern_return_t RetCode
;
171 } __Reply__mach_notify_dead_name_t
;
174 /* Forward Declarations */
177 mig_internal novalue _Xmach_notify_port_deleted
178 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
);
180 mig_internal novalue _Xmach_notify_port_destroyed
181 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
);
183 mig_internal novalue _Xmach_notify_no_senders
184 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
);
186 mig_internal novalue _Xmach_notify_send_once
187 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
);
189 mig_internal novalue _Xmach_notify_dead_name
190 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
);
193 /* SimpleRoutine mach_notify_port_deleted */
198 #endif /* mig_external */
199 kern_return_t cdsa_mach_notify_port_deleted
202 mach_port_name_t name
205 /* SimpleRoutine mach_notify_port_deleted */
206 mig_internal novalue _Xmach_notify_port_deleted
207 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
210 mach_msg_header_t Head
;
212 mach_port_name_t name
;
213 mach_msg_trailer_t trailer
;
217 typedef __Request__mach_notify_port_deleted_t __Request
;
220 typedef __Reply__mach_notify_port_deleted_t Reply
;
223 * mach_msg_header_t Head;
225 * kern_return_t RetCode;
226 * } mig_reply_error_t;
229 register Request
*In0P
= (Request
*) InHeadP
;
230 register Reply
*OutP
= (Reply
*) OutHeadP
;
231 __DeclareRcvSimple(65, "mach_notify_port_deleted")
232 __BeforeRcvSimple(65, "mach_notify_port_deleted")
234 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
235 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
236 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
237 #endif /* TypeCheck */
239 OutP
->RetCode
= cdsa_mach_notify_port_deleted(In0P
->Head
.msgh_request_port
, In0P
->name
);
240 __AfterRcvSimple(65, "mach_notify_port_deleted")
243 /* SimpleRoutine mach_notify_port_destroyed */
248 #endif /* mig_external */
249 kern_return_t cdsa_mach_notify_port_destroyed
255 /* SimpleRoutine mach_notify_port_destroyed */
256 mig_internal novalue _Xmach_notify_port_destroyed
257 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
260 mach_msg_header_t Head
;
261 /* start of the kernel processed data */
262 mach_msg_body_t msgh_body
;
263 mach_msg_port_descriptor_t rights
;
264 /* end of the kernel processed data */
265 mach_msg_trailer_t trailer
;
269 typedef __Request__mach_notify_port_destroyed_t __Request
;
272 typedef __Reply__mach_notify_port_destroyed_t Reply
;
275 * mach_msg_header_t Head;
277 * kern_return_t RetCode;
278 * } mig_reply_error_t;
281 register Request
*In0P
= (Request
*) InHeadP
;
282 register Reply
*OutP
= (Reply
*) OutHeadP
;
283 __DeclareRcvSimple(69, "mach_notify_port_destroyed")
284 __BeforeRcvSimple(69, "mach_notify_port_destroyed")
286 if (!(In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
287 (In0P
->msgh_body
.msgh_descriptor_count
!= 1) ||
288 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
289 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
290 #endif /* TypeCheck */
293 if (In0P
->rights
.type
!= MACH_MSG_PORT_DESCRIPTOR
||
294 In0P
->rights
.disposition
!= MACH_MSG_TYPE_MOVE_RECEIVE
)
295 { MIG_RETURN_ERROR(OutP
, MIG_TYPE_ERROR
); }
296 #endif /* TypeCheck */
298 OutP
->RetCode
= cdsa_mach_notify_port_destroyed(In0P
->Head
.msgh_request_port
, In0P
->rights
.name
);
299 __AfterRcvSimple(69, "mach_notify_port_destroyed")
302 /* SimpleRoutine mach_notify_no_senders */
307 #endif /* mig_external */
308 kern_return_t cdsa_mach_notify_no_senders
311 mach_port_mscount_t mscount
314 /* SimpleRoutine mach_notify_no_senders */
315 mig_internal novalue _Xmach_notify_no_senders
316 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
319 mach_msg_header_t Head
;
321 mach_port_mscount_t mscount
;
322 mach_msg_trailer_t trailer
;
326 typedef __Request__mach_notify_no_senders_t __Request
;
329 typedef __Reply__mach_notify_no_senders_t Reply
;
332 * mach_msg_header_t Head;
334 * kern_return_t RetCode;
335 * } mig_reply_error_t;
338 register Request
*In0P
= (Request
*) InHeadP
;
339 register Reply
*OutP
= (Reply
*) OutHeadP
;
340 __DeclareRcvSimple(70, "mach_notify_no_senders")
341 __BeforeRcvSimple(70, "mach_notify_no_senders")
343 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
344 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
345 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
346 #endif /* TypeCheck */
348 OutP
->RetCode
= cdsa_mach_notify_no_senders(In0P
->Head
.msgh_request_port
, In0P
->mscount
);
349 __AfterRcvSimple(70, "mach_notify_no_senders")
352 /* SimpleRoutine mach_notify_send_once */
357 #endif /* mig_external */
358 kern_return_t cdsa_mach_notify_send_once
363 /* SimpleRoutine mach_notify_send_once */
364 mig_internal novalue _Xmach_notify_send_once
365 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
368 mach_msg_header_t Head
;
369 mach_msg_trailer_t trailer
;
373 typedef __Request__mach_notify_send_once_t __Request
;
376 typedef __Reply__mach_notify_send_once_t Reply
;
379 * mach_msg_header_t Head;
381 * kern_return_t RetCode;
382 * } mig_reply_error_t;
385 register Request
*In0P
= (Request
*) InHeadP
;
386 register Reply
*OutP
= (Reply
*) OutHeadP
;
387 __DeclareRcvSimple(71, "mach_notify_send_once")
388 __BeforeRcvSimple(71, "mach_notify_send_once")
390 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
391 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
392 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
393 #endif /* TypeCheck */
395 OutP
->RetCode
= cdsa_mach_notify_send_once(In0P
->Head
.msgh_request_port
);
396 __AfterRcvSimple(71, "mach_notify_send_once")
399 /* SimpleRoutine mach_notify_dead_name */
404 #endif /* mig_external */
405 kern_return_t cdsa_mach_notify_dead_name
408 mach_port_name_t name
411 /* SimpleRoutine mach_notify_dead_name */
412 mig_internal novalue _Xmach_notify_dead_name
413 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
416 mach_msg_header_t Head
;
418 mach_port_name_t name
;
419 mach_msg_trailer_t trailer
;
423 typedef __Request__mach_notify_dead_name_t __Request
;
426 typedef __Reply__mach_notify_dead_name_t Reply
;
429 * mach_msg_header_t Head;
431 * kern_return_t RetCode;
432 * } mig_reply_error_t;
435 register Request
*In0P
= (Request
*) InHeadP
;
436 register Reply
*OutP
= (Reply
*) OutHeadP
;
437 __DeclareRcvSimple(72, "mach_notify_dead_name")
438 __BeforeRcvSimple(72, "mach_notify_dead_name")
440 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
441 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
442 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
443 #endif /* TypeCheck */
445 OutP
->RetCode
= cdsa_mach_notify_dead_name(In0P
->Head
.msgh_request_port
, In0P
->name
);
446 __AfterRcvSimple(72, "mach_notify_dead_name")
449 /* union of all requests */
451 union __RequestUnion__cdsa_notify_subsystem
{
452 __Request__mach_notify_port_deleted_t Request_mach_notify_port_deleted
;
453 __Request__mach_notify_port_destroyed_t Request_mach_notify_port_destroyed
;
454 __Request__mach_notify_no_senders_t Request_mach_notify_no_senders
;
455 __Request__mach_notify_send_once_t Request_mach_notify_send_once
;
456 __Request__mach_notify_dead_name_t Request_mach_notify_dead_name
;
459 /* union of all replies */
461 union __ReplyUnion__cdsa_notify_subsystem
{
462 __Reply__mach_notify_port_deleted_t Reply_mach_notify_port_deleted
;
463 __Reply__mach_notify_port_destroyed_t Reply_mach_notify_port_destroyed
;
464 __Reply__mach_notify_no_senders_t Reply_mach_notify_no_senders
;
465 __Reply__mach_notify_send_once_t Reply_mach_notify_send_once
;
466 __Reply__mach_notify_dead_name_t Reply_mach_notify_dead_name
;
470 extern boolean_t
cdsa_notify_server(
471 mach_msg_header_t
*InHeadP
,
472 mach_msg_header_t
*OutHeadP
);
474 extern mig_routine_t
notify_server_routine(
475 mach_msg_header_t
*InHeadP
);
478 /* Description of this subsystem, for use in direct RPC */
479 const struct cdsa_notify_subsystem
{
480 mig_server_routine_t server
; /* Server routine */
481 mach_msg_id_t start
; /* Min routine number */
482 mach_msg_id_t end
; /* Max routine number + 1 */
483 unsigned int maxsize
; /* Max msg size */
484 vm_address_t reserved
; /* Reserved */
485 struct routine_descriptor
/*Array of routine descriptors */
487 } cdsa_notify_subsystem
= {
488 notify_server_routine
,
491 sizeof(union __ReplyUnion__cdsa_notify_subsystem
),
495 { (mig_impl_routine_t
) 0,
496 (mig_stub_routine_t
) _Xmach_notify_port_deleted
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_port_deleted_t
)},
500 { (mig_impl_routine_t
) 0,
501 (mig_stub_routine_t
) _Xmach_notify_port_destroyed
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_port_destroyed_t
)},
502 { (mig_impl_routine_t
) 0,
503 (mig_stub_routine_t
) _Xmach_notify_no_senders
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_no_senders_t
)},
504 { (mig_impl_routine_t
) 0,
505 (mig_stub_routine_t
) _Xmach_notify_send_once
, 1, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_send_once_t
)},
506 { (mig_impl_routine_t
) 0,
507 (mig_stub_routine_t
) _Xmach_notify_dead_name
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_dead_name_t
)},
511 mig_external boolean_t cdsa_notify_server
512 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
516 * mach_msg_header_t Head;
518 * kern_return_t RetCode;
519 * } mig_reply_error_t;
522 register mig_routine_t routine
;
524 OutHeadP
->msgh_bits
= MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP
->msgh_bits
), 0);
525 OutHeadP
->msgh_remote_port
= InHeadP
->msgh_reply_port
;
526 /* Minimal size: routine() will update it if different */
527 OutHeadP
->msgh_size
= sizeof(mig_reply_error_t
);
528 OutHeadP
->msgh_local_port
= MACH_PORT_NULL
;
529 OutHeadP
->msgh_id
= InHeadP
->msgh_id
+ 100;
531 if ((InHeadP
->msgh_id
> 72) || (InHeadP
->msgh_id
< 64) ||
532 ((routine
= cdsa_notify_subsystem
.routine
[InHeadP
->msgh_id
- 64].stub_routine
) == 0)) {
533 ((mig_reply_error_t
*)OutHeadP
)->NDR
= NDR_record
;
534 ((mig_reply_error_t
*)OutHeadP
)->RetCode
= MIG_BAD_ID
;
537 (*routine
) (InHeadP
, OutHeadP
);
541 mig_external mig_routine_t notify_server_routine
542 (mach_msg_header_t
*InHeadP
)
544 register int msgh_id
;
546 msgh_id
= InHeadP
->msgh_id
- 64;
548 if ((msgh_id
> 8) || (msgh_id
< 0))
551 return cdsa_notify_subsystem
.routine
[msgh_id
].stub_routine
;