1 | /* |
2 | * IDENTIFICATION: |
3 | * stub generated Tue Apr 9 11:33:41 2019 |
4 | * with a MiG generated by bootstrap_cmds-96.20.2.200.4 |
5 | * OPTIONS: |
6 | * KernelServer |
7 | */ |
8 | |
9 | /* Module clock */ |
10 | |
11 | #define __MIG_check__Request__clock_subsystem__ 1 |
12 | |
13 | #include "clock_server.h" |
14 | |
15 | #ifndef mig_internal |
16 | #define mig_internal static __inline__ |
17 | #endif /* mig_internal */ |
18 | |
19 | #ifndef mig_external |
20 | #define mig_external |
21 | #endif /* mig_external */ |
22 | |
23 | #if !defined(__MigTypeCheck) && defined(TypeCheck) |
24 | #define __MigTypeCheck TypeCheck /* Legacy setting */ |
25 | #endif /* !defined(__MigTypeCheck) */ |
26 | |
27 | #if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) |
28 | #define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ |
29 | #endif /* !defined(__MigKernelSpecificCode) */ |
30 | |
31 | #ifndef LimitCheck |
32 | #define LimitCheck 0 |
33 | #endif /* LimitCheck */ |
34 | |
35 | #ifndef min |
36 | #define min(a,b) ( ((a) < (b))? (a): (b) ) |
37 | #endif /* min */ |
38 | |
39 | #if !defined(_WALIGN_) |
40 | #define _WALIGN_(x) (((x) + 3) & ~3) |
41 | #endif /* !defined(_WALIGN_) */ |
42 | |
43 | #if !defined(_WALIGNSZ_) |
44 | #define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) |
45 | #endif /* !defined(_WALIGNSZ_) */ |
46 | |
47 | #ifndef UseStaticTemplates |
48 | #define UseStaticTemplates 0 |
49 | #endif /* UseStaticTemplates */ |
50 | |
51 | #ifndef __DeclareRcvRpc |
52 | #define __DeclareRcvRpc(_NUM_, _NAME_) |
53 | #endif /* __DeclareRcvRpc */ |
54 | |
55 | #ifndef __BeforeRcvRpc |
56 | #define __BeforeRcvRpc(_NUM_, _NAME_) |
57 | #endif /* __BeforeRcvRpc */ |
58 | |
59 | #ifndef __AfterRcvRpc |
60 | #define __AfterRcvRpc(_NUM_, _NAME_) |
61 | #endif /* __AfterRcvRpc */ |
62 | |
63 | #ifndef __DeclareRcvSimple |
64 | #define __DeclareRcvSimple(_NUM_, _NAME_) |
65 | #endif /* __DeclareRcvSimple */ |
66 | |
67 | #ifndef __BeforeRcvSimple |
68 | #define __BeforeRcvSimple(_NUM_, _NAME_) |
69 | #endif /* __BeforeRcvSimple */ |
70 | |
71 | #ifndef __AfterRcvSimple |
72 | #define __AfterRcvSimple(_NUM_, _NAME_) |
73 | #endif /* __AfterRcvSimple */ |
74 | |
75 | #define novalue void |
76 | |
77 | #if __MigKernelSpecificCode |
78 | #define msgh_request_port msgh_remote_port |
79 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_REMOTE(bits) |
80 | #define msgh_reply_port msgh_local_port |
81 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_LOCAL(bits) |
82 | #else |
83 | #define msgh_request_port msgh_local_port |
84 | #define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) |
85 | #define msgh_reply_port msgh_remote_port |
86 | #define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) |
87 | #endif /* __MigKernelSpecificCode */ |
88 | |
89 | #define MIG_RETURN_ERROR(X, code) {\ |
90 | ((mig_reply_error_t *)X)->RetCode = code;\ |
91 | ((mig_reply_error_t *)X)->NDR = NDR_record;\ |
92 | return;\ |
93 | } |
94 | |
95 | /* Forward Declarations */ |
96 | |
97 | |
98 | mig_internal novalue _Xclock_get_time |
99 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
100 | |
101 | mig_internal novalue _Xclock_get_attributes |
102 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
103 | |
104 | mig_internal novalue _Xclock_alarm |
105 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); |
106 | |
107 | |
108 | #if ( __MigTypeCheck ) |
109 | #if __MIG_check__Request__clock_subsystem__ |
110 | #if !defined(__MIG_check__Request__clock_get_time_t__defined) |
111 | #define __MIG_check__Request__clock_get_time_t__defined |
112 | |
113 | mig_internal kern_return_t __MIG_check__Request__clock_get_time_t(__attribute__((__unused__)) __Request__clock_get_time_t *In0P) |
114 | { |
115 | |
116 | typedef __Request__clock_get_time_t __Request; |
117 | #if __MigTypeCheck |
118 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
119 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
120 | return MIG_BAD_ARGUMENTS; |
121 | #endif /* __MigTypeCheck */ |
122 | |
123 | return MACH_MSG_SUCCESS; |
124 | } |
125 | #endif /* !defined(__MIG_check__Request__clock_get_time_t__defined) */ |
126 | #endif /* __MIG_check__Request__clock_subsystem__ */ |
127 | #endif /* ( __MigTypeCheck ) */ |
128 | |
129 | |
130 | /* Routine clock_get_time */ |
131 | mig_internal novalue _Xclock_get_time |
132 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
133 | { |
134 | |
135 | #ifdef __MigPackStructs |
136 | #pragma pack(4) |
137 | #endif |
138 | typedef struct { |
139 | mach_msg_header_t Head; |
140 | mach_msg_trailer_t trailer; |
141 | } Request __attribute__((unused)); |
142 | #ifdef __MigPackStructs |
143 | #pragma pack() |
144 | #endif |
145 | typedef __Request__clock_get_time_t __Request; |
146 | typedef __Reply__clock_get_time_t Reply __attribute__((unused)); |
147 | |
148 | /* |
149 | * typedef struct { |
150 | * mach_msg_header_t Head; |
151 | * NDR_record_t NDR; |
152 | * kern_return_t RetCode; |
153 | * } mig_reply_error_t; |
154 | */ |
155 | |
156 | Request *In0P = (Request *) InHeadP; |
157 | Reply *OutP = (Reply *) OutHeadP; |
158 | #ifdef __MIG_check__Request__clock_get_time_t__defined |
159 | kern_return_t check_result; |
160 | #endif /* __MIG_check__Request__clock_get_time_t__defined */ |
161 | |
162 | #if __MigKernelSpecificCode |
163 | #else |
164 | #endif /* __MigKernelSpecificCode */ |
165 | __DeclareRcvRpc(1000, "clock_get_time" ) |
166 | __BeforeRcvRpc(1000, "clock_get_time" ) |
167 | |
168 | #if defined(__MIG_check__Request__clock_get_time_t__defined) |
169 | check_result = __MIG_check__Request__clock_get_time_t((__Request *)In0P); |
170 | if (check_result != MACH_MSG_SUCCESS) |
171 | { MIG_RETURN_ERROR(OutP, check_result); } |
172 | #endif /* defined(__MIG_check__Request__clock_get_time_t__defined) */ |
173 | |
174 | OutP->RetCode = clock_get_time(convert_port_to_clock(In0P->Head.msgh_request_port), &OutP->cur_time); |
175 | if (OutP->RetCode != KERN_SUCCESS) { |
176 | MIG_RETURN_ERROR(OutP, OutP->RetCode); |
177 | } |
178 | #if __MigKernelSpecificCode |
179 | #endif /* __MigKernelSpecificCode */ |
180 | |
181 | OutP->NDR = NDR_record; |
182 | |
183 | |
184 | OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply)); |
185 | __AfterRcvRpc(1000, "clock_get_time" ) |
186 | } |
187 | |
188 | #if ( __MigTypeCheck ) |
189 | #if __MIG_check__Request__clock_subsystem__ |
190 | #if !defined(__MIG_check__Request__clock_get_attributes_t__defined) |
191 | #define __MIG_check__Request__clock_get_attributes_t__defined |
192 | |
193 | mig_internal kern_return_t __MIG_check__Request__clock_get_attributes_t(__attribute__((__unused__)) __Request__clock_get_attributes_t *In0P) |
194 | { |
195 | |
196 | typedef __Request__clock_get_attributes_t __Request; |
197 | #if __MigTypeCheck |
198 | if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
199 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
200 | return MIG_BAD_ARGUMENTS; |
201 | #endif /* __MigTypeCheck */ |
202 | |
203 | return MACH_MSG_SUCCESS; |
204 | } |
205 | #endif /* !defined(__MIG_check__Request__clock_get_attributes_t__defined) */ |
206 | #endif /* __MIG_check__Request__clock_subsystem__ */ |
207 | #endif /* ( __MigTypeCheck ) */ |
208 | |
209 | |
210 | /* Routine clock_get_attributes */ |
211 | mig_internal novalue _Xclock_get_attributes |
212 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
213 | { |
214 | |
215 | #ifdef __MigPackStructs |
216 | #pragma pack(4) |
217 | #endif |
218 | typedef struct { |
219 | mach_msg_header_t Head; |
220 | NDR_record_t NDR; |
221 | clock_flavor_t flavor; |
222 | mach_msg_type_number_t clock_attrCnt; |
223 | mach_msg_trailer_t trailer; |
224 | } Request __attribute__((unused)); |
225 | #ifdef __MigPackStructs |
226 | #pragma pack() |
227 | #endif |
228 | typedef __Request__clock_get_attributes_t __Request; |
229 | typedef __Reply__clock_get_attributes_t Reply __attribute__((unused)); |
230 | |
231 | /* |
232 | * typedef struct { |
233 | * mach_msg_header_t Head; |
234 | * NDR_record_t NDR; |
235 | * kern_return_t RetCode; |
236 | * } mig_reply_error_t; |
237 | */ |
238 | |
239 | Request *In0P = (Request *) InHeadP; |
240 | Reply *OutP = (Reply *) OutHeadP; |
241 | #ifdef __MIG_check__Request__clock_get_attributes_t__defined |
242 | kern_return_t check_result; |
243 | #endif /* __MIG_check__Request__clock_get_attributes_t__defined */ |
244 | |
245 | #if __MigKernelSpecificCode |
246 | #else |
247 | #endif /* __MigKernelSpecificCode */ |
248 | __DeclareRcvRpc(1001, "clock_get_attributes" ) |
249 | __BeforeRcvRpc(1001, "clock_get_attributes" ) |
250 | |
251 | #if defined(__MIG_check__Request__clock_get_attributes_t__defined) |
252 | check_result = __MIG_check__Request__clock_get_attributes_t((__Request *)In0P); |
253 | if (check_result != MACH_MSG_SUCCESS) |
254 | { MIG_RETURN_ERROR(OutP, check_result); } |
255 | #endif /* defined(__MIG_check__Request__clock_get_attributes_t__defined) */ |
256 | |
257 | OutP->clock_attrCnt = 1; |
258 | if (In0P->clock_attrCnt < OutP->clock_attrCnt) |
259 | OutP->clock_attrCnt = In0P->clock_attrCnt; |
260 | |
261 | OutP->RetCode = clock_get_attributes(convert_port_to_clock(In0P->Head.msgh_request_port), In0P->flavor, OutP->clock_attr, &OutP->clock_attrCnt); |
262 | if (OutP->RetCode != KERN_SUCCESS) { |
263 | MIG_RETURN_ERROR(OutP, OutP->RetCode); |
264 | } |
265 | #if __MigKernelSpecificCode |
266 | #endif /* __MigKernelSpecificCode */ |
267 | |
268 | OutP->NDR = NDR_record; |
269 | |
270 | OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 4) + (((4 * OutP->clock_attrCnt))); |
271 | |
272 | __AfterRcvRpc(1001, "clock_get_attributes" ) |
273 | } |
274 | |
275 | #if ( __MigTypeCheck ) |
276 | #if __MIG_check__Request__clock_subsystem__ |
277 | #if !defined(__MIG_check__Request__clock_alarm_t__defined) |
278 | #define __MIG_check__Request__clock_alarm_t__defined |
279 | |
280 | mig_internal kern_return_t __MIG_check__Request__clock_alarm_t(__attribute__((__unused__)) __Request__clock_alarm_t *In0P) |
281 | { |
282 | |
283 | typedef __Request__clock_alarm_t __Request; |
284 | #if __MigTypeCheck |
285 | if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || |
286 | (In0P->msgh_body.msgh_descriptor_count != 1) || |
287 | (In0P->Head.msgh_size != (mach_msg_size_t)sizeof(__Request))) |
288 | return MIG_BAD_ARGUMENTS; |
289 | #endif /* __MigTypeCheck */ |
290 | |
291 | #if __MigTypeCheck |
292 | if (In0P->alarm_port.type != MACH_MSG_PORT_DESCRIPTOR) |
293 | return MIG_TYPE_ERROR; |
294 | #endif /* __MigTypeCheck */ |
295 | |
296 | return MACH_MSG_SUCCESS; |
297 | } |
298 | #endif /* !defined(__MIG_check__Request__clock_alarm_t__defined) */ |
299 | #endif /* __MIG_check__Request__clock_subsystem__ */ |
300 | #endif /* ( __MigTypeCheck ) */ |
301 | |
302 | |
303 | /* Routine clock_alarm */ |
304 | mig_internal novalue _Xclock_alarm |
305 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
306 | { |
307 | |
308 | #ifdef __MigPackStructs |
309 | #pragma pack(4) |
310 | #endif |
311 | typedef struct { |
312 | mach_msg_header_t Head; |
313 | /* start of the kernel processed data */ |
314 | mach_msg_body_t msgh_body; |
315 | mach_msg_port_descriptor_t alarm_port; |
316 | /* end of the kernel processed data */ |
317 | NDR_record_t NDR; |
318 | alarm_type_t alarm_type; |
319 | mach_timespec_t alarm_time; |
320 | mach_msg_trailer_t trailer; |
321 | } Request __attribute__((unused)); |
322 | #ifdef __MigPackStructs |
323 | #pragma pack() |
324 | #endif |
325 | typedef __Request__clock_alarm_t __Request; |
326 | typedef __Reply__clock_alarm_t Reply __attribute__((unused)); |
327 | |
328 | /* |
329 | * typedef struct { |
330 | * mach_msg_header_t Head; |
331 | * NDR_record_t NDR; |
332 | * kern_return_t RetCode; |
333 | * } mig_reply_error_t; |
334 | */ |
335 | |
336 | Request *In0P = (Request *) InHeadP; |
337 | Reply *OutP = (Reply *) OutHeadP; |
338 | #ifdef __MIG_check__Request__clock_alarm_t__defined |
339 | kern_return_t check_result; |
340 | #endif /* __MIG_check__Request__clock_alarm_t__defined */ |
341 | |
342 | #if __MigKernelSpecificCode |
343 | #else |
344 | #endif /* __MigKernelSpecificCode */ |
345 | __DeclareRcvRpc(1002, "clock_alarm" ) |
346 | __BeforeRcvRpc(1002, "clock_alarm" ) |
347 | |
348 | #if defined(__MIG_check__Request__clock_alarm_t__defined) |
349 | check_result = __MIG_check__Request__clock_alarm_t((__Request *)In0P); |
350 | if (check_result != MACH_MSG_SUCCESS) |
351 | { MIG_RETURN_ERROR(OutP, check_result); } |
352 | #endif /* defined(__MIG_check__Request__clock_alarm_t__defined) */ |
353 | |
354 | OutP->RetCode = clock_alarm(convert_port_to_clock(In0P->Head.msgh_request_port), In0P->alarm_type, In0P->alarm_time, In0P->alarm_port.name, In0P->alarm_port.disposition); |
355 | #if __MigKernelSpecificCode |
356 | #endif /* __MigKernelSpecificCode */ |
357 | |
358 | OutP->NDR = NDR_record; |
359 | |
360 | |
361 | __AfterRcvRpc(1002, "clock_alarm" ) |
362 | } |
363 | |
364 | |
365 | |
366 | /* Description of this subsystem, for use in direct RPC */ |
367 | const struct clock_subsystem clock_subsystem = { |
368 | clock_server_routine, |
369 | 1000, |
370 | 1003, |
371 | (mach_msg_size_t)sizeof(union __ReplyUnion__clock_subsystem), |
372 | (vm_address_t)0, |
373 | { |
374 | { (mig_impl_routine_t) 0, |
375 | (mig_stub_routine_t) _Xclock_get_time, 2, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_get_time_t)}, |
376 | { (mig_impl_routine_t) 0, |
377 | (mig_stub_routine_t) _Xclock_get_attributes, 4, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_get_attributes_t)}, |
378 | { (mig_impl_routine_t) 0, |
379 | (mig_stub_routine_t) _Xclock_alarm, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__clock_alarm_t)}, |
380 | } |
381 | }; |
382 | |
383 | mig_external boolean_t clock_server |
384 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
385 | { |
386 | /* |
387 | * typedef struct { |
388 | * mach_msg_header_t Head; |
389 | * NDR_record_t NDR; |
390 | * kern_return_t RetCode; |
391 | * } mig_reply_error_t; |
392 | */ |
393 | |
394 | register mig_routine_t routine; |
395 | |
396 | OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); |
397 | OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; |
398 | /* Minimal size: routine() will update it if different */ |
399 | OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); |
400 | OutHeadP->msgh_local_port = MACH_PORT_NULL; |
401 | OutHeadP->msgh_id = InHeadP->msgh_id + 100; |
402 | OutHeadP->msgh_reserved = 0; |
403 | |
404 | if ((InHeadP->msgh_id > 1002) || (InHeadP->msgh_id < 1000) || |
405 | ((routine = clock_subsystem.routine[InHeadP->msgh_id - 1000].stub_routine) == 0)) { |
406 | ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; |
407 | ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; |
408 | return FALSE; |
409 | } |
410 | (*routine) (InHeadP, OutHeadP); |
411 | return TRUE; |
412 | } |
413 | |
414 | mig_external mig_routine_t clock_server_routine |
415 | (mach_msg_header_t *InHeadP) |
416 | { |
417 | register int msgh_id; |
418 | |
419 | msgh_id = InHeadP->msgh_id - 1000; |
420 | |
421 | if ((msgh_id > 2) || (msgh_id < 0)) |
422 | return 0; |
423 | |
424 | return clock_subsystem.routine[msgh_id].stub_routine; |
425 | } |
426 | |