2 * Copyright (c) 2001-2002,2004 Apple Computer, 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
;
216 typedef __Request__mach_notify_port_deleted_t __Request
;
218 typedef __Reply__mach_notify_port_deleted_t Reply
;
221 * mach_msg_header_t Head;
223 * kern_return_t RetCode;
224 * } mig_reply_error_t;
227 register Request
*In0P
= (Request
*) InHeadP
;
228 register Reply
*OutP
= (Reply
*) OutHeadP
;
229 __DeclareRcvSimple(65, "mach_notify_port_deleted")
230 __BeforeRcvSimple(65, "mach_notify_port_deleted")
232 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
233 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
234 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
235 #endif /* TypeCheck */
237 OutP
->RetCode
= cdsa_mach_notify_port_deleted(In0P
->Head
.msgh_request_port
, In0P
->name
);
238 __AfterRcvSimple(65, "mach_notify_port_deleted")
241 /* SimpleRoutine mach_notify_port_destroyed */
246 #endif /* mig_external */
247 kern_return_t cdsa_mach_notify_port_destroyed
253 /* SimpleRoutine mach_notify_port_destroyed */
254 mig_internal novalue _Xmach_notify_port_destroyed
255 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
258 mach_msg_header_t Head
;
259 /* start of the kernel processed data */
260 mach_msg_body_t msgh_body
;
261 mach_msg_port_descriptor_t rights
;
262 /* end of the kernel processed data */
263 mach_msg_trailer_t trailer
;
266 typedef __Request__mach_notify_port_destroyed_t __Request
;
268 typedef __Reply__mach_notify_port_destroyed_t Reply
;
271 * mach_msg_header_t Head;
273 * kern_return_t RetCode;
274 * } mig_reply_error_t;
277 register Request
*In0P
= (Request
*) InHeadP
;
278 register Reply
*OutP
= (Reply
*) OutHeadP
;
279 __DeclareRcvSimple(69, "mach_notify_port_destroyed")
280 __BeforeRcvSimple(69, "mach_notify_port_destroyed")
282 if (!(In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
283 (In0P
->msgh_body
.msgh_descriptor_count
!= 1) ||
284 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
285 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
286 #endif /* TypeCheck */
289 if (In0P
->rights
.type
!= MACH_MSG_PORT_DESCRIPTOR
||
290 In0P
->rights
.disposition
!= MACH_MSG_TYPE_MOVE_RECEIVE
)
291 { MIG_RETURN_ERROR(OutP
, MIG_TYPE_ERROR
); }
292 #endif /* TypeCheck */
294 OutP
->RetCode
= cdsa_mach_notify_port_destroyed(In0P
->Head
.msgh_request_port
, In0P
->rights
.name
);
295 __AfterRcvSimple(69, "mach_notify_port_destroyed")
298 /* SimpleRoutine mach_notify_no_senders */
303 #endif /* mig_external */
304 kern_return_t cdsa_mach_notify_no_senders
307 mach_port_mscount_t mscount
310 /* SimpleRoutine mach_notify_no_senders */
311 mig_internal novalue _Xmach_notify_no_senders
312 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
315 mach_msg_header_t Head
;
317 mach_port_mscount_t mscount
;
318 mach_msg_trailer_t trailer
;
321 typedef __Request__mach_notify_no_senders_t __Request
;
323 typedef __Reply__mach_notify_no_senders_t Reply
;
326 * mach_msg_header_t Head;
328 * kern_return_t RetCode;
329 * } mig_reply_error_t;
332 register Request
*In0P
= (Request
*) InHeadP
;
333 register Reply
*OutP
= (Reply
*) OutHeadP
;
334 __DeclareRcvSimple(70, "mach_notify_no_senders")
335 __BeforeRcvSimple(70, "mach_notify_no_senders")
337 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
338 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
339 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
340 #endif /* TypeCheck */
342 OutP
->RetCode
= cdsa_mach_notify_no_senders(In0P
->Head
.msgh_request_port
, In0P
->mscount
);
343 __AfterRcvSimple(70, "mach_notify_no_senders")
346 /* SimpleRoutine mach_notify_send_once */
351 #endif /* mig_external */
352 kern_return_t cdsa_mach_notify_send_once
357 /* SimpleRoutine mach_notify_send_once */
358 mig_internal novalue _Xmach_notify_send_once
359 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
362 mach_msg_header_t Head
;
363 mach_msg_trailer_t trailer
;
366 typedef __Request__mach_notify_send_once_t __Request
;
368 typedef __Reply__mach_notify_send_once_t Reply
;
371 * mach_msg_header_t Head;
373 * kern_return_t RetCode;
374 * } mig_reply_error_t;
377 register Request
*In0P
= (Request
*) InHeadP
;
378 register Reply
*OutP
= (Reply
*) OutHeadP
;
379 __DeclareRcvSimple(71, "mach_notify_send_once")
380 __BeforeRcvSimple(71, "mach_notify_send_once")
382 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
383 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
384 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
385 #endif /* TypeCheck */
387 OutP
->RetCode
= cdsa_mach_notify_send_once(In0P
->Head
.msgh_request_port
);
388 __AfterRcvSimple(71, "mach_notify_send_once")
391 /* SimpleRoutine mach_notify_dead_name */
396 #endif /* mig_external */
397 kern_return_t cdsa_mach_notify_dead_name
400 mach_port_name_t name
403 /* SimpleRoutine mach_notify_dead_name */
404 mig_internal novalue _Xmach_notify_dead_name
405 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
408 mach_msg_header_t Head
;
410 mach_port_name_t name
;
411 mach_msg_trailer_t trailer
;
414 typedef __Request__mach_notify_dead_name_t __Request
;
416 typedef __Reply__mach_notify_dead_name_t Reply
;
419 * mach_msg_header_t Head;
421 * kern_return_t RetCode;
422 * } mig_reply_error_t;
425 register Request
*In0P
= (Request
*) InHeadP
;
426 register Reply
*OutP
= (Reply
*) OutHeadP
;
427 __DeclareRcvSimple(72, "mach_notify_dead_name")
428 __BeforeRcvSimple(72, "mach_notify_dead_name")
430 if ((In0P
->Head
.msgh_bits
& MACH_MSGH_BITS_COMPLEX
) ||
431 (In0P
->Head
.msgh_size
!= sizeof(__Request
)))
432 { MIG_RETURN_ERROR(OutP
, MIG_BAD_ARGUMENTS
); }
433 #endif /* TypeCheck */
435 OutP
->RetCode
= cdsa_mach_notify_dead_name(In0P
->Head
.msgh_request_port
, In0P
->name
);
436 __AfterRcvSimple(72, "mach_notify_dead_name")
439 /* union of all requests */
441 union __RequestUnion__cdsa_notify_subsystem
{
442 __Request__mach_notify_port_deleted_t Request_mach_notify_port_deleted
;
443 __Request__mach_notify_port_destroyed_t Request_mach_notify_port_destroyed
;
444 __Request__mach_notify_no_senders_t Request_mach_notify_no_senders
;
445 __Request__mach_notify_send_once_t Request_mach_notify_send_once
;
446 __Request__mach_notify_dead_name_t Request_mach_notify_dead_name
;
449 /* union of all replies */
451 union __ReplyUnion__cdsa_notify_subsystem
{
452 __Reply__mach_notify_port_deleted_t Reply_mach_notify_port_deleted
;
453 __Reply__mach_notify_port_destroyed_t Reply_mach_notify_port_destroyed
;
454 __Reply__mach_notify_no_senders_t Reply_mach_notify_no_senders
;
455 __Reply__mach_notify_send_once_t Reply_mach_notify_send_once
;
456 __Reply__mach_notify_dead_name_t Reply_mach_notify_dead_name
;
460 extern boolean_t
cdsa_notify_server(
461 mach_msg_header_t
*InHeadP
,
462 mach_msg_header_t
*OutHeadP
);
464 extern mig_routine_t
notify_server_routine(
465 mach_msg_header_t
*InHeadP
);
468 /* Description of this subsystem, for use in direct RPC */
469 const struct cdsa_notify_subsystem
{
470 mig_server_routine_t server
; /* Server routine */
471 mach_msg_id_t start
; /* Min routine number */
472 mach_msg_id_t end
; /* Max routine number + 1 */
473 unsigned int maxsize
; /* Max msg size */
474 vm_address_t reserved
; /* Reserved */
475 struct routine_descriptor
/*Array of routine descriptors */
477 } cdsa_notify_subsystem
= {
478 notify_server_routine
,
481 sizeof(union __ReplyUnion__cdsa_notify_subsystem
),
485 { (mig_impl_routine_t
) 0,
486 (mig_stub_routine_t
) _Xmach_notify_port_deleted
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_port_deleted_t
)},
490 { (mig_impl_routine_t
) 0,
491 (mig_stub_routine_t
) _Xmach_notify_port_destroyed
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_port_destroyed_t
)},
492 { (mig_impl_routine_t
) 0,
493 (mig_stub_routine_t
) _Xmach_notify_no_senders
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_no_senders_t
)},
494 { (mig_impl_routine_t
) 0,
495 (mig_stub_routine_t
) _Xmach_notify_send_once
, 1, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_send_once_t
)},
496 { (mig_impl_routine_t
) 0,
497 (mig_stub_routine_t
) _Xmach_notify_dead_name
, 2, 0, (routine_arg_descriptor_t
)0, sizeof(__Reply__mach_notify_dead_name_t
)},
501 mig_external boolean_t cdsa_notify_server
502 (mach_msg_header_t
*InHeadP
, mach_msg_header_t
*OutHeadP
)
506 * mach_msg_header_t Head;
508 * kern_return_t RetCode;
509 * } mig_reply_error_t;
512 register mig_routine_t routine
;
514 OutHeadP
->msgh_bits
= MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP
->msgh_bits
), 0);
515 OutHeadP
->msgh_remote_port
= InHeadP
->msgh_reply_port
;
516 /* Minimal size: routine() will update it if different */
517 OutHeadP
->msgh_size
= sizeof(mig_reply_error_t
);
518 OutHeadP
->msgh_local_port
= MACH_PORT_NULL
;
519 OutHeadP
->msgh_id
= InHeadP
->msgh_id
+ 100;
521 if ((InHeadP
->msgh_id
> 72) || (InHeadP
->msgh_id
< 64) ||
522 ((routine
= cdsa_notify_subsystem
.routine
[InHeadP
->msgh_id
- 64].stub_routine
) == 0)) {
523 ((mig_reply_error_t
*)OutHeadP
)->NDR
= NDR_record
;
524 ((mig_reply_error_t
*)OutHeadP
)->RetCode
= MIG_BAD_ID
;
527 (*routine
) (InHeadP
, OutHeadP
);
531 mig_external mig_routine_t notify_server_routine
532 (mach_msg_header_t
*InHeadP
)
534 register int msgh_id
;
536 msgh_id
= InHeadP
->msgh_id
- 64;
538 if ((msgh_id
> 8) || (msgh_id
< 0))
541 return cdsa_notify_subsystem
.routine
[msgh_id
].stub_routine
;