1 | /* |
2 | * IDENTIFICATION: |
3 | * stub generated by bootstrap_cmds-133 |
4 | * OPTIONS: |
5 | * KernelUser |
6 | */ |
7 | #define __MIG_check__Reply__lockd_mach_subsystem__ 1 |
8 | |
9 | #include "lockd_mach.h" |
10 | |
11 | /* TODO: #include <mach/mach.h> */ |
12 | #ifdef __cplusplus |
13 | extern "C" { |
14 | #endif /* __cplusplus */ |
15 | extern 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 | /* SimpleRoutine lockd_request */ |
120 | mig_external kern_return_t lockd_request |
121 | ( |
122 | mach_port_t server, |
123 | uint32_t vers, |
124 | uint32_t flags, |
125 | uint64_t xid, |
126 | int64_t flk_start, |
127 | int64_t flk_len, |
128 | int32_t flk_pid, |
129 | int32_t flk_type, |
130 | int32_t flk_whence, |
131 | sock_storage sock_address, |
132 | xcred cred, |
133 | uint32_t fh_len, |
134 | nfs_handle fh |
135 | ) |
136 | { |
137 | |
138 | #ifdef __MigPackStructs |
139 | #pragma pack(push, 4) |
140 | #endif |
141 | typedef struct { |
142 | mach_msg_header_t Head; |
143 | NDR_record_t NDR; |
144 | uint32_t vers; |
145 | uint32_t flags; |
146 | uint64_t xid; |
147 | int64_t flk_start; |
148 | int64_t flk_len; |
149 | int32_t flk_pid; |
150 | int32_t flk_type; |
151 | int32_t flk_whence; |
152 | sock_storage sock_address; |
153 | xcred cred; |
154 | uint32_t fh_len; |
155 | nfs_handle fh; |
156 | } Request __attribute__((unused)); |
157 | #ifdef __MigPackStructs |
158 | #pragma pack(pop) |
159 | #endif |
160 | /* |
161 | * typedef struct { |
162 | * mach_msg_header_t Head; |
163 | * NDR_record_t NDR; |
164 | * kern_return_t RetCode; |
165 | * } mig_reply_error_t; |
166 | */ |
167 | |
168 | union { |
169 | Request In; |
170 | } Mess; |
171 | |
172 | Request *InP = &Mess.In; |
173 | |
174 | mach_msg_return_t msg_result; |
175 | |
176 | #ifdef __MIG_check__Reply__lockd_request_t__defined |
177 | kern_return_t check_result; |
178 | #endif /* __MIG_check__Reply__lockd_request_t__defined */ |
179 | |
180 | __DeclareSendSimple(1023, "lockd_request" ) |
181 | |
182 | InP->NDR = NDR_record; |
183 | |
184 | InP->vers = vers; |
185 | |
186 | InP->flags = flags; |
187 | |
188 | InP->xid = xid; |
189 | |
190 | InP->flk_start = flk_start; |
191 | |
192 | InP->flk_len = flk_len; |
193 | |
194 | InP->flk_pid = flk_pid; |
195 | |
196 | InP->flk_type = flk_type; |
197 | |
198 | InP->flk_whence = flk_whence; |
199 | |
200 | { typedef struct { char data[128]; } *sp; |
201 | * (sp) InP->sock_address = * (sp) sock_address; |
202 | } |
203 | |
204 | { typedef struct { char data[76]; } *sp; |
205 | * (sp) InP->cred = * (sp) cred; |
206 | } |
207 | |
208 | InP->fh_len = fh_len; |
209 | |
210 | { typedef struct { char data[64]; } *sp; |
211 | * (sp) InP->fh = * (sp) fh; |
212 | } |
213 | |
214 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
215 | InP->Head.msgh_bits = |
216 | MACH_MSGH_BITS(19, 0); |
217 | /* msgh_size passed as argument */ |
218 | InP->Head.msgh_request_port = server; |
219 | InP->Head.msgh_id = 1023; |
220 | InP->Head.msgh_reserved = 0; |
221 | |
222 | __BeforeSendSimple(1023, "lockd_request" ) |
223 | #if __MigKernelSpecificCode |
224 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
225 | #else |
226 | 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); |
227 | #endif /* __MigKernelSpecificCode */ |
228 | __AfterSendSimple(1023, "lockd_request" ) |
229 | return msg_result; |
230 | } |
231 | |
232 | #if ( __MigTypeCheck ) |
233 | #if __MIG_check__Reply__lockd_mach_subsystem__ |
234 | #if !defined(__MIG_check__Reply__lockd_ping_t__defined) |
235 | #define __MIG_check__Reply__lockd_ping_t__defined |
236 | |
237 | mig_internal kern_return_t __MIG_check__Reply__lockd_ping_t(__Reply__lockd_ping_t *Out0P) |
238 | { |
239 | |
240 | typedef __Reply__lockd_ping_t __Reply __attribute__((unused)); |
241 | if (Out0P->Head.msgh_id != 1124) { |
242 | if (Out0P->Head.msgh_id == MACH_NOTIFY_SEND_ONCE) |
243 | { return MIG_SERVER_DIED; } |
244 | else |
245 | { return MIG_REPLY_MISMATCH; } |
246 | } |
247 | |
248 | #if __MigTypeCheck |
249 | if ((Out0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
250 | (Out0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Reply))) |
251 | { return MIG_TYPE_ERROR ; } |
252 | #endif /* __MigTypeCheck */ |
253 | |
254 | #if __MigTypeCheck |
255 | if (Out0P->Head.msgh_request_port != MACH_PORT_NULL) { |
256 | return MIG_TYPE_ERROR; |
257 | } |
258 | #endif /* __MigTypeCheck */ |
259 | { |
260 | return Out0P->RetCode; |
261 | } |
262 | } |
263 | #endif /* !defined(__MIG_check__Reply__lockd_ping_t__defined) */ |
264 | #endif /* __MIG_check__Reply__lockd_mach_subsystem__ */ |
265 | #endif /* ( __MigTypeCheck ) */ |
266 | |
267 | |
268 | /* Routine lockd_ping */ |
269 | mig_external kern_return_t lockd_ping |
270 | ( |
271 | mach_port_t server |
272 | ) |
273 | { |
274 | |
275 | #ifdef __MigPackStructs |
276 | #pragma pack(push, 4) |
277 | #endif |
278 | typedef struct { |
279 | mach_msg_header_t Head; |
280 | } Request __attribute__((unused)); |
281 | #ifdef __MigPackStructs |
282 | #pragma pack(pop) |
283 | #endif |
284 | |
285 | #ifdef __MigPackStructs |
286 | #pragma pack(push, 4) |
287 | #endif |
288 | typedef struct { |
289 | mach_msg_header_t Head; |
290 | NDR_record_t NDR; |
291 | kern_return_t RetCode; |
292 | mach_msg_trailer_t trailer; |
293 | } Reply __attribute__((unused)); |
294 | #ifdef __MigPackStructs |
295 | #pragma pack(pop) |
296 | #endif |
297 | |
298 | #ifdef __MigPackStructs |
299 | #pragma pack(push, 4) |
300 | #endif |
301 | typedef struct { |
302 | mach_msg_header_t Head; |
303 | NDR_record_t NDR; |
304 | kern_return_t RetCode; |
305 | } __Reply __attribute__((unused)); |
306 | #ifdef __MigPackStructs |
307 | #pragma pack(pop) |
308 | #endif |
309 | /* |
310 | * typedef struct { |
311 | * mach_msg_header_t Head; |
312 | * NDR_record_t NDR; |
313 | * kern_return_t RetCode; |
314 | * } mig_reply_error_t; |
315 | */ |
316 | |
317 | union { |
318 | Request In; |
319 | Reply Out; |
320 | } Mess; |
321 | |
322 | Request *InP = &Mess.In; |
323 | Reply *Out0P = &Mess.Out; |
324 | |
325 | mach_msg_return_t msg_result; |
326 | |
327 | #ifdef __MIG_check__Reply__lockd_ping_t__defined |
328 | kern_return_t check_result; |
329 | #endif /* __MIG_check__Reply__lockd_ping_t__defined */ |
330 | |
331 | __DeclareSendRpc(1024, "lockd_ping" ) |
332 | |
333 | InP->Head.msgh_reply_port = mig_get_reply_port(); |
334 | InP->Head.msgh_bits = |
335 | MACH_MSGH_BITS(19, MACH_MSG_TYPE_MAKE_SEND_ONCE); |
336 | /* msgh_size passed as argument */ |
337 | InP->Head.msgh_request_port = server; |
338 | InP->Head.msgh_id = 1024; |
339 | InP->Head.msgh_reserved = 0; |
340 | |
341 | __BeforeSendRpc(1024, "lockd_ping" ) |
342 | #if (__MigKernelSpecificCode) || (_MIG_KERNELSPECIFIC_CODE_) |
343 | 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)); |
344 | #else |
345 | 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); |
346 | #endif /* __MigKernelSpecificCode */ |
347 | __AfterSendRpc(1024, "lockd_ping" ) |
348 | if (msg_result != MACH_MSG_SUCCESS) { |
349 | __MachMsgErrorWithoutTimeout(msg_result); |
350 | } |
351 | if (msg_result != MACH_MSG_SUCCESS) { |
352 | { return msg_result; } |
353 | } |
354 | |
355 | |
356 | #if defined(__MIG_check__Reply__lockd_ping_t__defined) |
357 | check_result = __MIG_check__Reply__lockd_ping_t(Out0P: (__Reply__lockd_ping_t *)Out0P); |
358 | if (check_result != MACH_MSG_SUCCESS) { |
359 | #if __MigKernelSpecificCode |
360 | mach_msg_destroy_from_kernel(msg: &Out0P->Head); |
361 | #endif /* __MigKernelSpecificCode */ |
362 | { return check_result; } |
363 | } |
364 | #endif /* defined(__MIG_check__Reply__lockd_ping_t__defined) */ |
365 | |
366 | return KERN_SUCCESS; |
367 | } |
368 | |
369 | /* SimpleRoutine lockd_shutdown */ |
370 | mig_external kern_return_t lockd_shutdown |
371 | ( |
372 | mach_port_t server |
373 | ) |
374 | { |
375 | |
376 | #ifdef __MigPackStructs |
377 | #pragma pack(push, 4) |
378 | #endif |
379 | typedef struct { |
380 | mach_msg_header_t Head; |
381 | } Request __attribute__((unused)); |
382 | #ifdef __MigPackStructs |
383 | #pragma pack(pop) |
384 | #endif |
385 | /* |
386 | * typedef struct { |
387 | * mach_msg_header_t Head; |
388 | * NDR_record_t NDR; |
389 | * kern_return_t RetCode; |
390 | * } mig_reply_error_t; |
391 | */ |
392 | |
393 | union { |
394 | Request In; |
395 | } Mess; |
396 | |
397 | Request *InP = &Mess.In; |
398 | |
399 | mach_msg_return_t msg_result; |
400 | |
401 | #ifdef __MIG_check__Reply__lockd_shutdown_t__defined |
402 | kern_return_t check_result; |
403 | #endif /* __MIG_check__Reply__lockd_shutdown_t__defined */ |
404 | |
405 | __DeclareSendSimple(1025, "lockd_shutdown" ) |
406 | |
407 | InP->Head.msgh_reply_port = MACH_PORT_NULL; |
408 | InP->Head.msgh_bits = |
409 | MACH_MSGH_BITS(19, 0); |
410 | /* msgh_size passed as argument */ |
411 | InP->Head.msgh_request_port = server; |
412 | InP->Head.msgh_id = 1025; |
413 | InP->Head.msgh_reserved = 0; |
414 | |
415 | __BeforeSendSimple(1025, "lockd_shutdown" ) |
416 | #if __MigKernelSpecificCode |
417 | msg_result = mach_msg_send_from_kernel(msg: &InP->Head, send_size: (mach_msg_size_t)sizeof(Request)); |
418 | #else |
419 | 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); |
420 | #endif /* __MigKernelSpecificCode */ |
421 | __AfterSendSimple(1025, "lockd_shutdown" ) |
422 | return msg_result; |
423 | } |
424 | |