1 | #ifndef _lock_set_server_ |
2 | #define _lock_set_server_ |
3 | |
4 | /* Module lock_set */ |
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 |
26 | extern "C" { |
27 | #endif |
28 | extern int mig_strncpy_zerofill(char *dest, const char *src, int len) __attribute__((weak_import)); |
29 | #ifdef __cplusplus |
30 | } |
31 | #endif |
32 | #endif /* __MIG_STRNCPY_ZEROFILL_FORWARD_TYPE_DECLS__ */ |
33 | #endif /* __has_include(<mach/mig_strncpy_zerofill_support.h>) */ |
34 | #endif /* __has_include */ |
35 | |
36 | /* END MIG_STRNCPY_ZEROFILL CODE */ |
37 | |
38 | |
39 | #ifdef AUTOTEST |
40 | #ifndef FUNCTION_PTR_T |
41 | #define FUNCTION_PTR_T |
42 | typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); |
43 | typedef struct { |
44 | char *name; |
45 | function_ptr_t function; |
46 | } function_table_entry; |
47 | typedef function_table_entry *function_table_t; |
48 | #endif /* FUNCTION_PTR_T */ |
49 | #endif /* AUTOTEST */ |
50 | |
51 | #ifndef lock_set_MSG_COUNT |
52 | #define lock_set_MSG_COUNT 6 |
53 | #endif /* lock_set_MSG_COUNT */ |
54 | |
55 | #include <mach/std_types.h> |
56 | #include <mach/mig.h> |
57 | #include <ipc/ipc_voucher.h> |
58 | #include <kern/ipc_kobject.h> |
59 | #include <kern/ipc_tt.h> |
60 | #include <kern/ipc_host.h> |
61 | #include <kern/ipc_sync.h> |
62 | #include <kern/ledger.h> |
63 | #include <kern/processor.h> |
64 | #include <kern/sync_lock.h> |
65 | #include <kern/sync_sema.h> |
66 | #include <vm/memory_object.h> |
67 | #include <vm/vm_map.h> |
68 | #include <kern/ipc_mig.h> |
69 | #include <mach/mig.h> |
70 | #include <mach/mach_types.h> |
71 | |
72 | #ifdef __BeforeMigServerHeader |
73 | __BeforeMigServerHeader |
74 | #endif /* __BeforeMigServerHeader */ |
75 | |
76 | |
77 | /* Routine lock_acquire */ |
78 | #ifdef mig_external |
79 | mig_external |
80 | #else |
81 | extern |
82 | #endif /* mig_external */ |
83 | kern_return_t lock_acquire |
84 | ( |
85 | lock_set_t lock_set, |
86 | int lock_id |
87 | ); |
88 | |
89 | /* Routine lock_release */ |
90 | #ifdef mig_external |
91 | mig_external |
92 | #else |
93 | extern |
94 | #endif /* mig_external */ |
95 | kern_return_t lock_release |
96 | ( |
97 | lock_set_t lock_set, |
98 | int lock_id |
99 | ); |
100 | |
101 | /* Routine lock_try */ |
102 | #ifdef mig_external |
103 | mig_external |
104 | #else |
105 | extern |
106 | #endif /* mig_external */ |
107 | kern_return_t lock_try |
108 | ( |
109 | lock_set_t lock_set, |
110 | int lock_id |
111 | ); |
112 | |
113 | /* Routine lock_make_stable */ |
114 | #ifdef mig_external |
115 | mig_external |
116 | #else |
117 | extern |
118 | #endif /* mig_external */ |
119 | kern_return_t lock_make_stable |
120 | ( |
121 | lock_set_t lock_set, |
122 | int lock_id |
123 | ); |
124 | |
125 | /* Routine lock_handoff */ |
126 | #ifdef mig_external |
127 | mig_external |
128 | #else |
129 | extern |
130 | #endif /* mig_external */ |
131 | kern_return_t lock_handoff |
132 | ( |
133 | lock_set_t lock_set, |
134 | int lock_id |
135 | ); |
136 | |
137 | /* Routine lock_handoff_accept */ |
138 | #ifdef mig_external |
139 | mig_external |
140 | #else |
141 | extern |
142 | #endif /* mig_external */ |
143 | kern_return_t lock_handoff_accept |
144 | ( |
145 | lock_set_t lock_set, |
146 | int lock_id |
147 | ); |
148 | |
149 | #ifdef mig_external |
150 | mig_external |
151 | #else |
152 | extern |
153 | #endif /* mig_external */ |
154 | boolean_t lock_set_server( |
155 | mach_msg_header_t *InHeadP, |
156 | mach_msg_header_t *OutHeadP); |
157 | |
158 | #ifdef mig_external |
159 | mig_external |
160 | #else |
161 | extern |
162 | #endif /* mig_external */ |
163 | mig_routine_t lock_set_server_routine( |
164 | mach_msg_header_t *InHeadP); |
165 | |
166 | |
167 | /* Description of this subsystem, for use in direct RPC */ |
168 | extern const struct lock_set_subsystem { |
169 | mig_server_routine_t server; /* Server routine */ |
170 | mach_msg_id_t start; /* Min routine number */ |
171 | mach_msg_id_t end; /* Max routine number + 1 */ |
172 | unsigned int maxsize; /* Max msg size */ |
173 | vm_address_t reserved; /* Reserved */ |
174 | struct routine_descriptor /*Array of routine descriptors */ |
175 | routine[6]; |
176 | } lock_set_subsystem; |
177 | |
178 | /* typedefs for all requests */ |
179 | |
180 | #ifndef __Request__lock_set_subsystem__defined |
181 | #define __Request__lock_set_subsystem__defined |
182 | |
183 | #ifdef __MigPackStructs |
184 | #pragma pack(4) |
185 | #endif |
186 | typedef struct { |
187 | mach_msg_header_t Head; |
188 | NDR_record_t NDR; |
189 | int lock_id; |
190 | } __Request__lock_acquire_t __attribute__((unused)); |
191 | #ifdef __MigPackStructs |
192 | #pragma pack() |
193 | #endif |
194 | |
195 | #ifdef __MigPackStructs |
196 | #pragma pack(4) |
197 | #endif |
198 | typedef struct { |
199 | mach_msg_header_t Head; |
200 | NDR_record_t NDR; |
201 | int lock_id; |
202 | } __Request__lock_release_t __attribute__((unused)); |
203 | #ifdef __MigPackStructs |
204 | #pragma pack() |
205 | #endif |
206 | |
207 | #ifdef __MigPackStructs |
208 | #pragma pack(4) |
209 | #endif |
210 | typedef struct { |
211 | mach_msg_header_t Head; |
212 | NDR_record_t NDR; |
213 | int lock_id; |
214 | } __Request__lock_try_t __attribute__((unused)); |
215 | #ifdef __MigPackStructs |
216 | #pragma pack() |
217 | #endif |
218 | |
219 | #ifdef __MigPackStructs |
220 | #pragma pack(4) |
221 | #endif |
222 | typedef struct { |
223 | mach_msg_header_t Head; |
224 | NDR_record_t NDR; |
225 | int lock_id; |
226 | } __Request__lock_make_stable_t __attribute__((unused)); |
227 | #ifdef __MigPackStructs |
228 | #pragma pack() |
229 | #endif |
230 | |
231 | #ifdef __MigPackStructs |
232 | #pragma pack(4) |
233 | #endif |
234 | typedef struct { |
235 | mach_msg_header_t Head; |
236 | NDR_record_t NDR; |
237 | int lock_id; |
238 | } __Request__lock_handoff_t __attribute__((unused)); |
239 | #ifdef __MigPackStructs |
240 | #pragma pack() |
241 | #endif |
242 | |
243 | #ifdef __MigPackStructs |
244 | #pragma pack(4) |
245 | #endif |
246 | typedef struct { |
247 | mach_msg_header_t Head; |
248 | NDR_record_t NDR; |
249 | int lock_id; |
250 | } __Request__lock_handoff_accept_t __attribute__((unused)); |
251 | #ifdef __MigPackStructs |
252 | #pragma pack() |
253 | #endif |
254 | #endif /* !__Request__lock_set_subsystem__defined */ |
255 | |
256 | |
257 | /* union of all requests */ |
258 | |
259 | #ifndef __RequestUnion__lock_set_subsystem__defined |
260 | #define __RequestUnion__lock_set_subsystem__defined |
261 | union __RequestUnion__lock_set_subsystem { |
262 | __Request__lock_acquire_t Request_lock_acquire; |
263 | __Request__lock_release_t Request_lock_release; |
264 | __Request__lock_try_t Request_lock_try; |
265 | __Request__lock_make_stable_t Request_lock_make_stable; |
266 | __Request__lock_handoff_t Request_lock_handoff; |
267 | __Request__lock_handoff_accept_t Request_lock_handoff_accept; |
268 | }; |
269 | #endif /* __RequestUnion__lock_set_subsystem__defined */ |
270 | /* typedefs for all replies */ |
271 | |
272 | #ifndef __Reply__lock_set_subsystem__defined |
273 | #define __Reply__lock_set_subsystem__defined |
274 | |
275 | #ifdef __MigPackStructs |
276 | #pragma pack(4) |
277 | #endif |
278 | typedef struct { |
279 | mach_msg_header_t Head; |
280 | NDR_record_t NDR; |
281 | kern_return_t RetCode; |
282 | } __Reply__lock_acquire_t __attribute__((unused)); |
283 | #ifdef __MigPackStructs |
284 | #pragma pack() |
285 | #endif |
286 | |
287 | #ifdef __MigPackStructs |
288 | #pragma pack(4) |
289 | #endif |
290 | typedef struct { |
291 | mach_msg_header_t Head; |
292 | NDR_record_t NDR; |
293 | kern_return_t RetCode; |
294 | } __Reply__lock_release_t __attribute__((unused)); |
295 | #ifdef __MigPackStructs |
296 | #pragma pack() |
297 | #endif |
298 | |
299 | #ifdef __MigPackStructs |
300 | #pragma pack(4) |
301 | #endif |
302 | typedef struct { |
303 | mach_msg_header_t Head; |
304 | NDR_record_t NDR; |
305 | kern_return_t RetCode; |
306 | } __Reply__lock_try_t __attribute__((unused)); |
307 | #ifdef __MigPackStructs |
308 | #pragma pack() |
309 | #endif |
310 | |
311 | #ifdef __MigPackStructs |
312 | #pragma pack(4) |
313 | #endif |
314 | typedef struct { |
315 | mach_msg_header_t Head; |
316 | NDR_record_t NDR; |
317 | kern_return_t RetCode; |
318 | } __Reply__lock_make_stable_t __attribute__((unused)); |
319 | #ifdef __MigPackStructs |
320 | #pragma pack() |
321 | #endif |
322 | |
323 | #ifdef __MigPackStructs |
324 | #pragma pack(4) |
325 | #endif |
326 | typedef struct { |
327 | mach_msg_header_t Head; |
328 | NDR_record_t NDR; |
329 | kern_return_t RetCode; |
330 | } __Reply__lock_handoff_t __attribute__((unused)); |
331 | #ifdef __MigPackStructs |
332 | #pragma pack() |
333 | #endif |
334 | |
335 | #ifdef __MigPackStructs |
336 | #pragma pack(4) |
337 | #endif |
338 | typedef struct { |
339 | mach_msg_header_t Head; |
340 | NDR_record_t NDR; |
341 | kern_return_t RetCode; |
342 | } __Reply__lock_handoff_accept_t __attribute__((unused)); |
343 | #ifdef __MigPackStructs |
344 | #pragma pack() |
345 | #endif |
346 | #endif /* !__Reply__lock_set_subsystem__defined */ |
347 | |
348 | |
349 | /* union of all replies */ |
350 | |
351 | #ifndef __ReplyUnion__lock_set_subsystem__defined |
352 | #define __ReplyUnion__lock_set_subsystem__defined |
353 | union __ReplyUnion__lock_set_subsystem { |
354 | __Reply__lock_acquire_t Reply_lock_acquire; |
355 | __Reply__lock_release_t Reply_lock_release; |
356 | __Reply__lock_try_t Reply_lock_try; |
357 | __Reply__lock_make_stable_t Reply_lock_make_stable; |
358 | __Reply__lock_handoff_t Reply_lock_handoff; |
359 | __Reply__lock_handoff_accept_t Reply_lock_handoff_accept; |
360 | }; |
361 | #endif /* __RequestUnion__lock_set_subsystem__defined */ |
362 | |
363 | #ifndef subsystem_to_name_map_lock_set |
364 | #define subsystem_to_name_map_lock_set \ |
365 | { "lock_acquire", 617000 },\ |
366 | { "lock_release", 617001 },\ |
367 | { "lock_try", 617002 },\ |
368 | { "lock_make_stable", 617003 },\ |
369 | { "lock_handoff", 617004 },\ |
370 | { "lock_handoff_accept", 617005 } |
371 | #endif |
372 | |
373 | #ifdef __AfterMigServerHeader |
374 | __AfterMigServerHeader |
375 | #endif /* __AfterMigServerHeader */ |
376 | |
377 | #endif /* _lock_set_server_ */ |
378 | |