1#ifndef _clock_server_
2#define _clock_server_
3
4/* Module clock */
5
6#include <string.h>
7#include <mach/ndr.h>
8#include <mach/boolean.h>
9#include <mach/kern_return.h>
10#include <mach/notify.h>
11#include <mach/mach_types.h>
12#include <mach/message.h>
13#include <mach/mig_errors.h>
14#include <mach/port.h>
15
16/* BEGIN MIG_STRNCPY_ZEROFILL CODE */
17
18#if defined(__has_include)
19#if __has_include(<mach/mig_strncpy_zerofill_support.h>)
20#ifndef USING_MIG_STRNCPY_ZEROFILL
21#define USING_MIG_STRNCPY_ZEROFILL
22#endif
23#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
24#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__
25#ifdef __cplusplus
26extern "C" {
27#endif
28#ifndef __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_ATTR
29#define __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS_CSTRING_COUNTEDBY_ATTR(C) __unsafe_indexable
30#endif
31 extern int mig_strncpy_zerofill(char * dest, const char * src, int len) __attribute__((weak_import));
32#ifdef __cplusplus
33}
34#endif
35#endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */
36#endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */
37#endif /* __has_include */
38
39/* END MIG_STRNCPY_ZEROFILL CODE */
40
41
42#ifdef AUTOTEST
43#ifndef FUNCTION_PTR_T
44#define FUNCTION_PTR_T
45typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t);
46typedef struct {
47 char * name;
48 function_ptr_t function;
49} function_table_entry;
50typedef function_table_entry *function_table_t;
51#endif /* FUNCTION_PTR_T */
52#endif /* AUTOTEST */
53
54#ifndef clock_MSG_COUNT
55#define clock_MSG_COUNT 3
56#endif /* clock_MSG_COUNT */
57
58#include <Availability.h>
59#include <mach/std_types.h>
60#include <mach/mig.h>
61#include <ipc/ipc_voucher.h>
62#include <kern/ipc_kobject.h>
63#include <kern/ipc_tt.h>
64#include <kern/ipc_host.h>
65#include <kern/ledger.h>
66#include <kern/processor.h>
67#include <kern/sync_sema.h>
68#include <ipc/ipc_eventlink.h>
69#include <vm/memory_object.h>
70#include <vm/vm_map.h>
71#include <kern/arcade.h>
72#include <kern/ipc_mig.h>
73#include <kern/task_ident.h>
74#include <kern/kern_cdata.h>
75#include <mach/mig.h>
76#include <mach/mach_types.h>
77#include <mach/mach_types.h>
78
79#ifdef __BeforeMigServerHeader
80__BeforeMigServerHeader
81#endif /* __BeforeMigServerHeader */
82
83#ifndef MIG_SERVER_ROUTINE
84#define MIG_SERVER_ROUTINE
85#endif
86
87
88/* Routine clock_get_time */
89#ifdef mig_external
90mig_external
91#else
92extern
93#endif /* mig_external */
94MIG_SERVER_ROUTINE
95kern_return_t clock_get_time
96(
97 clock_serv_t clock_serv,
98 mach_timespec_t *cur_time
99);
100
101/* Routine clock_get_attributes */
102#ifdef mig_external
103mig_external
104#else
105extern
106#endif /* mig_external */
107MIG_SERVER_ROUTINE
108kern_return_t clock_get_attributes
109(
110 clock_serv_t clock_serv,
111 clock_flavor_t flavor,
112 clock_attr_t clock_attr,
113 mach_msg_type_number_t *clock_attrCnt
114);
115
116/* Routine clock_alarm */
117#ifdef mig_external
118mig_external
119#else
120extern
121#endif /* mig_external */
122MIG_SERVER_ROUTINE
123kern_return_t clock_alarm
124(
125 clock_serv_t clock_serv,
126 alarm_type_t alarm_type,
127 mach_timespec_t alarm_time,
128 clock_reply_t alarm_port,
129 mach_msg_type_name_t alarm_portPoly
130);
131
132#ifdef mig_external
133mig_external
134#else
135extern
136#endif /* mig_external */
137boolean_t clock_server(
138 mach_msg_header_t *InHeadP,
139 void *InDataP,
140 mach_msg_max_trailer_t *InTrailerP,
141 mach_msg_header_t *OutHeadP,
142 void *OutDataP);
143
144#ifdef mig_external
145mig_external
146#else
147extern
148#endif /* mig_external */
149mig_kern_routine_t clock_server_routine(
150 mach_msg_header_t *InHeadP);
151
152
153/* Description of this kernel subsystem, for use in direct RPC */
154extern const struct clock_subsystem {
155 mig_kern_server_routine_t kserver; /* Server routine */
156 mach_msg_id_t start; /* Min routine number */
157 mach_msg_id_t end; /* Max routine number + 1 */
158 unsigned int maxsize; /* Max msg size */
159 vm_address_t reserved; /* Reserved */
160 struct kern_routine_descriptor /* Array of routine descriptors */
161 kroutine[3];
162} clock_subsystem;
163
164/* typedefs for all requests */
165
166#ifndef __Request__clock_subsystem__defined
167#define __Request__clock_subsystem__defined
168
169#ifdef __MigPackStructs
170#pragma pack(push, 4)
171#endif
172 typedef struct {
173 mach_msg_header_t Head;
174 } __Request__clock_get_time_t __attribute__((unused));
175#ifdef __MigPackStructs
176#pragma pack(pop)
177#endif
178/* Struct for kernel processed data (Header + Descriptors) */
179#ifdef __MigPackStructs
180#pragma pack(push, 4)
181#endif
182 typedef struct {
183 mach_msg_header_t Head;
184 } __RequestKData__clock_get_time_t __attribute__((unused));
185#ifdef __MigPackStructs
186#pragma pack(pop)
187#endif
188/* Struct for pure user data */
189#ifdef __MigPackStructs
190#pragma pack(push, 4)
191#endif
192 typedef struct {
193 char padding[0]; /* Avoid generating empty UData structs */
194 } __RequestUData__clock_get_time_t __attribute__((unused));
195#ifdef __MigPackStructs
196#pragma pack(pop)
197#endif
198
199#ifdef __MigPackStructs
200#pragma pack(push, 4)
201#endif
202 typedef struct {
203 mach_msg_header_t Head;
204 NDR_record_t NDR;
205 clock_flavor_t flavor;
206 mach_msg_type_number_t clock_attrCnt;
207 } __Request__clock_get_attributes_t __attribute__((unused));
208#ifdef __MigPackStructs
209#pragma pack(pop)
210#endif
211/* Struct for kernel processed data (Header + Descriptors) */
212#ifdef __MigPackStructs
213#pragma pack(push, 4)
214#endif
215 typedef struct {
216 mach_msg_header_t Head;
217 } __RequestKData__clock_get_attributes_t __attribute__((unused));
218#ifdef __MigPackStructs
219#pragma pack(pop)
220#endif
221/* Struct for pure user data */
222#ifdef __MigPackStructs
223#pragma pack(push, 4)
224#endif
225 typedef struct {
226 NDR_record_t NDR;
227 clock_flavor_t flavor;
228 mach_msg_type_number_t clock_attrCnt;
229 char padding[0]; /* Avoid generating empty UData structs */
230 } __RequestUData__clock_get_attributes_t __attribute__((unused));
231#ifdef __MigPackStructs
232#pragma pack(pop)
233#endif
234
235#ifdef __MigPackStructs
236#pragma pack(push, 4)
237#endif
238 typedef struct {
239 mach_msg_header_t Head;
240 /* start of the kernel processed data */
241 mach_msg_body_t msgh_body;
242 mach_msg_port_descriptor_t alarm_port;
243 /* end of the kernel processed data */
244 NDR_record_t NDR;
245 alarm_type_t alarm_type;
246 mach_timespec_t alarm_time;
247 } __Request__clock_alarm_t __attribute__((unused));
248#ifdef __MigPackStructs
249#pragma pack(pop)
250#endif
251/* Struct for kernel processed data (Header + Descriptors) */
252#ifdef __MigPackStructs
253#pragma pack(push, 4)
254#endif
255 typedef struct {
256 mach_msg_header_t Head;
257 mach_msg_body_t msgh_body;
258 mach_msg_port_descriptor_t alarm_port;
259 } __RequestKData__clock_alarm_t __attribute__((unused));
260#ifdef __MigPackStructs
261#pragma pack(pop)
262#endif
263/* Struct for pure user data */
264#ifdef __MigPackStructs
265#pragma pack(push, 4)
266#endif
267 typedef struct {
268 NDR_record_t NDR;
269 alarm_type_t alarm_type;
270 mach_timespec_t alarm_time;
271 char padding[0]; /* Avoid generating empty UData structs */
272 } __RequestUData__clock_alarm_t __attribute__((unused));
273#ifdef __MigPackStructs
274#pragma pack(pop)
275#endif
276#endif /* !__Request__clock_subsystem__defined */
277
278
279/* union of all requests */
280
281#ifndef __RequestUnion__clock_subsystem__defined
282#define __RequestUnion__clock_subsystem__defined
283union __RequestUnion__clock_subsystem {
284 __Request__clock_get_time_t Request_clock_get_time;
285 __Request__clock_get_attributes_t Request_clock_get_attributes;
286 __Request__clock_alarm_t Request_clock_alarm;
287};
288#endif /* __RequestUnion__clock_subsystem__defined */
289/* typedefs for all replies */
290
291#ifndef __Reply__clock_subsystem__defined
292#define __Reply__clock_subsystem__defined
293
294#ifdef __MigPackStructs
295#pragma pack(push, 4)
296#endif
297 typedef struct {
298 mach_msg_header_t Head;
299 NDR_record_t NDR;
300 kern_return_t RetCode;
301 mach_timespec_t cur_time;
302 } __Reply__clock_get_time_t __attribute__((unused));
303#ifdef __MigPackStructs
304#pragma pack(pop)
305#endif
306/* Struct for kernel processed data (Header + Descriptors) */
307#ifdef __MigPackStructs
308#pragma pack(push, 4)
309#endif
310 typedef struct {
311 mach_msg_header_t Head;
312 } __ReplyKData__clock_get_time_t __attribute__((unused));
313#ifdef __MigPackStructs
314#pragma pack(pop)
315#endif
316/* Struct for pure user data */
317#ifdef __MigPackStructs
318#pragma pack(push, 4)
319#endif
320 typedef struct {
321 NDR_record_t NDR;
322 kern_return_t RetCode;
323 mach_timespec_t cur_time;
324 char padding[0]; /* Avoid generating empty UData structs */
325 } __ReplyUData__clock_get_time_t __attribute__((unused));
326#ifdef __MigPackStructs
327#pragma pack(pop)
328#endif
329
330#ifdef __MigPackStructs
331#pragma pack(push, 4)
332#endif
333 typedef struct {
334 mach_msg_header_t Head;
335 NDR_record_t NDR;
336 kern_return_t RetCode;
337 mach_msg_type_number_t clock_attrCnt;
338 int clock_attr[1];
339 } __Reply__clock_get_attributes_t __attribute__((unused));
340#ifdef __MigPackStructs
341#pragma pack(pop)
342#endif
343/* Struct for kernel processed data (Header + Descriptors) */
344#ifdef __MigPackStructs
345#pragma pack(push, 4)
346#endif
347 typedef struct {
348 mach_msg_header_t Head;
349 } __ReplyKData__clock_get_attributes_t __attribute__((unused));
350#ifdef __MigPackStructs
351#pragma pack(pop)
352#endif
353/* Struct for pure user data */
354#ifdef __MigPackStructs
355#pragma pack(push, 4)
356#endif
357 typedef struct {
358 NDR_record_t NDR;
359 kern_return_t RetCode;
360 mach_msg_type_number_t clock_attrCnt;
361 int clock_attr[1];
362 char padding[0]; /* Avoid generating empty UData structs */
363 } __ReplyUData__clock_get_attributes_t __attribute__((unused));
364#ifdef __MigPackStructs
365#pragma pack(pop)
366#endif
367
368#ifdef __MigPackStructs
369#pragma pack(push, 4)
370#endif
371 typedef struct {
372 mach_msg_header_t Head;
373 NDR_record_t NDR;
374 kern_return_t RetCode;
375 } __Reply__clock_alarm_t __attribute__((unused));
376#ifdef __MigPackStructs
377#pragma pack(pop)
378#endif
379/* Struct for kernel processed data (Header + Descriptors) */
380#ifdef __MigPackStructs
381#pragma pack(push, 4)
382#endif
383 typedef struct {
384 mach_msg_header_t Head;
385 } __ReplyKData__clock_alarm_t __attribute__((unused));
386#ifdef __MigPackStructs
387#pragma pack(pop)
388#endif
389/* Struct for pure user data */
390#ifdef __MigPackStructs
391#pragma pack(push, 4)
392#endif
393 typedef struct {
394 NDR_record_t NDR;
395 kern_return_t RetCode;
396 char padding[0]; /* Avoid generating empty UData structs */
397 } __ReplyUData__clock_alarm_t __attribute__((unused));
398#ifdef __MigPackStructs
399#pragma pack(pop)
400#endif
401#endif /* !__Reply__clock_subsystem__defined */
402
403
404/* union of all replies */
405
406#ifndef __ReplyUnion__clock_subsystem__defined
407#define __ReplyUnion__clock_subsystem__defined
408union __ReplyUnion__clock_subsystem {
409 __Reply__clock_get_time_t Reply_clock_get_time;
410 __Reply__clock_get_attributes_t Reply_clock_get_attributes;
411 __Reply__clock_alarm_t Reply_clock_alarm;
412};
413#endif /* __ReplyUnion__clock_subsystem__defined */
414
415#ifndef subsystem_to_name_map_clock
416#define subsystem_to_name_map_clock \
417 { "clock_get_time", 1000 },\
418 { "clock_get_attributes", 1001 },\
419 { "clock_alarm", 1002 }
420#endif
421
422#ifdef __AfterMigServerHeader
423__AfterMigServerHeader
424#endif /* __AfterMigServerHeader */
425
426#endif /* _clock_server_ */
427