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