1/*
2 * IDENTIFICATION:
3 * stub generated by bootstrap_cmds-133
4 * OPTIONS:
5 * KernelUser
6 */
7#define __MIG_check__Reply__mach_test_upcall_subsystem__ 1
8
9#include "mach_test_upcall.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__mach_test_upcall_subsystem__
121#if !defined(__MIG_check__Reply__mach_test_sync_upcall_t__defined)
122#define __MIG_check__Reply__mach_test_sync_upcall_t__defined
123
124mig_internal kern_return_t __MIG_check__Reply__mach_test_sync_upcall_t(__Reply__mach_test_sync_upcall_t *Out0P)
125{
126
127 typedef __Reply__mach_test_sync_upcall_t __Reply __attribute__((unused));
128 if (Out0P->Head.msgh_id != 225) {
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__mach_test_sync_upcall_t__defined) */
151#endif /* __MIG_check__Reply__mach_test_upcall_subsystem__ */
152#endif /* ( __MigTypeCheck ) */
153
154
155/* Routine mach_test_sync_upcall */
156mig_external kern_return_t mach_test_sync_upcall
157(
158 mach_port_t port
159)
160{
161
162#ifdef __MigPackStructs
163#pragma pack(push, 4)
164#endif
165 typedef struct {
166 mach_msg_header_t Head;
167 } Request __attribute__((unused));
168#ifdef __MigPackStructs
169#pragma pack(pop)
170#endif
171
172#ifdef __MigPackStructs
173#pragma pack(push, 4)
174#endif
175 typedef struct {
176 mach_msg_header_t Head;
177 NDR_record_t NDR;
178 kern_return_t RetCode;
179 mach_msg_trailer_t trailer;
180 } Reply __attribute__((unused));
181#ifdef __MigPackStructs
182#pragma pack(pop)
183#endif
184
185#ifdef __MigPackStructs
186#pragma pack(push, 4)
187#endif
188 typedef struct {
189 mach_msg_header_t Head;
190 NDR_record_t NDR;
191 kern_return_t RetCode;
192 } __Reply __attribute__((unused));
193#ifdef __MigPackStructs
194#pragma pack(pop)
195#endif
196 /*
197 * typedef struct {
198 * mach_msg_header_t Head;
199 * NDR_record_t NDR;
200 * kern_return_t RetCode;
201 * } mig_reply_error_t;
202 */
203
204 union {
205 Request In;
206 Reply Out;
207 } Mess;
208
209 Request *InP = &Mess.In;
210 Reply *Out0P = &Mess.Out;
211
212 mach_msg_return_t msg_result;
213
214#ifdef __MIG_check__Reply__mach_test_sync_upcall_t__defined
215 kern_return_t check_result;
216#endif /* __MIG_check__Reply__mach_test_sync_upcall_t__defined */
217
218 __DeclareSendRpc(125, "mach_test_sync_upcall")
219
220 InP->Head.msgh_reply_port = mig_get_reply_port();
221 InP->Head.msgh_bits =
222 MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE);
223 /* msgh_size passed as argument */
224 InP->Head.msgh_request_port = port;
225 InP->Head.msgh_id = 125;
226 InP->Head.msgh_reserved = 0;
227
228 __BeforeSendRpc(125, "mach_test_sync_upcall")
229#if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_)
230 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));
231#else
232 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);
233#endif /* __MigKernelSpecificCode */
234 __AfterSendRpc(125, "mach_test_sync_upcall")
235 if (msg_result != MACH_MSG_SUCCESS) {
236 __MachMsgErrorWithoutTimeout(msg_result);
237 }
238 if (msg_result != MACH_MSG_SUCCESS) {
239 { return msg_result; }
240 }
241
242
243#if defined(__MIG_check__Reply__mach_test_sync_upcall_t__defined)
244 check_result = __MIG_check__Reply__mach_test_sync_upcall_t(Out0P: (__Reply__mach_test_sync_upcall_t *)Out0P);
245 if (check_result != MACH_MSG_SUCCESS) {
246#if __MigKernelSpecificCode
247 mach_msg_destroy_from_kernel(msg: &Out0P->Head);
248#endif /* __MigKernelSpecificCode */
249 { return check_result; }
250 }
251#endif /* defined(__MIG_check__Reply__mach_test_sync_upcall_t__defined) */
252
253 return KERN_SUCCESS;
254}
255
256/* SimpleRoutine mach_test_async_upcall */
257mig_external kern_return_t mach_test_async_upcall
258(
259 mach_port_t port
260)
261{
262
263#ifdef __MigPackStructs
264#pragma pack(push, 4)
265#endif
266 typedef struct {
267 mach_msg_header_t Head;
268 } Request __attribute__((unused));
269#ifdef __MigPackStructs
270#pragma pack(pop)
271#endif
272 /*
273 * typedef struct {
274 * mach_msg_header_t Head;
275 * NDR_record_t NDR;
276 * kern_return_t RetCode;
277 * } mig_reply_error_t;
278 */
279
280 union {
281 Request In;
282 } Mess;
283
284 Request *InP = &Mess.In;
285
286 mach_msg_return_t msg_result;
287
288#ifdef __MIG_check__Reply__mach_test_async_upcall_t__defined
289 kern_return_t check_result;
290#endif /* __MIG_check__Reply__mach_test_async_upcall_t__defined */
291
292 __DeclareSendSimple(126, "mach_test_async_upcall")
293
294 InP->Head.msgh_reply_port = MACH_PORT_NULL;
295 InP->Head.msgh_bits =
296 MACH_MSGH_BITS(19, 0);
297 /* msgh_size passed as argument */
298 InP->Head.msgh_request_port = port;
299 InP->Head.msgh_id = 126;
300 InP->Head.msgh_reserved = 0;
301
302 __BeforeSendSimple(126, "mach_test_async_upcall")
303#if __MigKernelSpecificCode
304 msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request));
305#else
306 msg_result = mach_msg(&InP->Head, MACH_SEND_MSG|MACH_MSG_OPTION_NONE, (mach_msg_size_t)sizeof(Request), 0, MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
307#endif /* __MigKernelSpecificCode */
308 __AfterSendSimple(126, "mach_test_async_upcall")
309 return msg_result;
310}
311