File: | obj-scan-build/ipc/mach_port.server.c |
Location: | line 1331, column 2 |
Description: | Assigned value is garbage or undefined |
1 | /* Module mach_port */ |
2 | |
3 | #ifndef _GNU_SOURCE1 |
4 | #define _GNU_SOURCE1 1 |
5 | #endif |
6 | |
7 | #define EXPORT_BOOLEAN |
8 | #include <mach/boolean.h> |
9 | #include <mach/kern_return.h> |
10 | #include <mach/message.h> |
11 | #include <mach/mig_errors.h> |
12 | #include <mach/mig_support.h> |
13 | #include <ipc/ipc_port.h> |
14 | |
15 | #ifndef mig_internalstatic |
16 | #define mig_internalstatic static |
17 | #endif |
18 | |
19 | #ifndef mig_external |
20 | #define mig_external |
21 | #endif |
22 | |
23 | #ifndef mig_unlikely |
24 | #define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0) |
25 | #endif |
26 | |
27 | #ifndef TypeCheck1 |
28 | #define TypeCheck1 1 |
29 | #endif |
30 | |
31 | #ifndef UseExternRCSId1 |
32 | #define UseExternRCSId1 1 |
33 | #endif |
34 | |
35 | #define BAD_TYPECHECK(type, check)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) mig_unlikely (({\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
36 | union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
37 | _t.t = *(type); _c.t = *(check);_t.w != _c.w; }))__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(type); _c.t = *(check);_t.w != _c.w; } )), 0) |
38 | #define msgh_request_portmsgh_remote_port msgh_remote_port |
39 | #define MACH_MSGH_BITS_REQUEST(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
40 | #define msgh_reply_portmsgh_local_port msgh_local_port |
41 | #define MACH_MSGH_BITS_REPLY(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
42 | |
43 | #include <mach/std_types.h> |
44 | #include <kern/ipc_kobject.h> |
45 | #include <kern/ipc_tt.h> |
46 | #include <kern/ipc_host.h> |
47 | #include <kern/task.h> |
48 | #include <kern/thread.h> |
49 | #include <kern/host.h> |
50 | #include <kern/processor.h> |
51 | #include <vm/vm_object.h> |
52 | #include <vm/vm_map.h> |
53 | #include <ipc/ipc_space.h> |
54 | #include <mach/mach_types.h> |
55 | |
56 | /* Routine mach_port_names */ |
57 | mig_internalstatic void _Xmach_port_names |
58 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
59 | { |
60 | typedef struct { |
61 | mach_msg_header_t Head; |
62 | } Request; |
63 | |
64 | typedef struct { |
65 | mach_msg_header_t Head; |
66 | mach_msg_type_t RetCodeType; |
67 | kern_return_t RetCode; |
68 | mach_msg_type_long_t namesType; |
69 | mach_port_array_t names; |
70 | mach_msg_type_long_t typesType; |
71 | mach_port_type_array_t types; |
72 | } Reply; |
73 | |
74 | Request *In0P = (Request *) InHeadP; |
75 | Reply *OutP = (Reply *) OutHeadP; |
76 | mig_external kern_return_t mach_port_names |
77 | (ipc_space_t task, mach_port_array_t *names, mach_msg_type_number_t *namesCnt, mach_port_type_array_t *types, mach_msg_type_number_t *typesCnt); |
78 | |
79 | const mach_msg_type_long_t namesType = { |
80 | { |
81 | /* msgt_name = */ 0, |
82 | /* msgt_size = */ 0, |
83 | /* msgt_number = */ 0, |
84 | /* msgt_inline = */ FALSE((boolean_t) 0), |
85 | /* msgt_longform = */ TRUE((boolean_t) 1), |
86 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
87 | /* msgt_unused = */ 0 |
88 | }, |
89 | /* msgtl_name = */ 15, |
90 | /* msgtl_size = */ 32, |
91 | /* msgtl_number = */ 0, |
92 | }; |
93 | |
94 | const mach_msg_type_long_t typesType = { |
95 | { |
96 | /* msgt_name = */ 0, |
97 | /* msgt_size = */ 0, |
98 | /* msgt_number = */ 0, |
99 | /* msgt_inline = */ FALSE((boolean_t) 0), |
100 | /* msgt_longform = */ TRUE((boolean_t) 1), |
101 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
102 | /* msgt_unused = */ 0 |
103 | }, |
104 | /* msgtl_name = */ 2, |
105 | /* msgtl_size = */ 32, |
106 | /* msgtl_number = */ 0, |
107 | }; |
108 | |
109 | ipc_space_t task; |
110 | mach_msg_type_number_t namesCnt; |
111 | mach_msg_type_number_t typesCnt; |
112 | |
113 | #if TypeCheck1 |
114 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
115 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
116 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
117 | #endif /* TypeCheck */ |
118 | |
119 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
120 | |
121 | OutP->RetCode = mach_port_names(task, &OutP->names, &namesCnt, &OutP->types, &typesCnt); |
122 | space_deallocate(task); |
123 | if (OutP->RetCode != KERN_SUCCESS0) |
124 | return; |
125 | |
126 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
127 | OutP->Head.msgh_size = 64; |
128 | |
129 | OutP->namesType = namesType; |
130 | |
131 | OutP->namesType.msgtl_number = namesCnt; |
132 | |
133 | OutP->typesType = typesType; |
134 | |
135 | OutP->typesType.msgtl_number = typesCnt; |
136 | } |
137 | |
138 | /* Default implementation of mach_port_names */ |
139 | #ifdef MIG_EOPNOTSUPP |
140 | kern_return_t __attribute__ ((weak)) |
141 | mach_port_names |
142 | ( |
143 | ipc_space_t task, |
144 | mach_port_array_t *names, |
145 | mach_msg_type_number_t *namesCnt, |
146 | mach_port_type_array_t *types, |
147 | mach_msg_type_number_t *typesCnt |
148 | ) { return MIG_EOPNOTSUPP; } |
149 | #endif /* MIG_EOPNOTSUPP */ |
150 | |
151 | /* Routine mach_port_type */ |
152 | mig_internalstatic void _Xmach_port_type |
153 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
154 | { |
155 | typedef struct { |
156 | mach_msg_header_t Head; |
157 | mach_msg_type_t nameType; |
158 | mach_port_t name; |
159 | } Request; |
160 | |
161 | typedef struct { |
162 | mach_msg_header_t Head; |
163 | mach_msg_type_t RetCodeType; |
164 | kern_return_t RetCode; |
165 | mach_msg_type_t ptypeType; |
166 | mach_port_type_t ptype; |
167 | } Reply; |
168 | |
169 | Request *In0P = (Request *) InHeadP; |
170 | Reply *OutP = (Reply *) OutHeadP; |
171 | mig_external kern_return_t mach_port_type |
172 | (ipc_space_t task, mach_port_t name, mach_port_type_t *ptype); |
173 | |
174 | const mach_msg_type_t nameCheck = { |
175 | /* msgt_name = */ 15, |
176 | /* msgt_size = */ 32, |
177 | /* msgt_number = */ 1, |
178 | /* msgt_inline = */ TRUE((boolean_t) 1), |
179 | /* msgt_longform = */ FALSE((boolean_t) 0), |
180 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
181 | /* msgt_unused = */ 0 |
182 | }; |
183 | |
184 | const mach_msg_type_t ptypeType = { |
185 | /* msgt_name = */ 2, |
186 | /* msgt_size = */ 32, |
187 | /* msgt_number = */ 1, |
188 | /* msgt_inline = */ TRUE((boolean_t) 1), |
189 | /* msgt_longform = */ FALSE((boolean_t) 0), |
190 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
191 | /* msgt_unused = */ 0 |
192 | }; |
193 | |
194 | ipc_space_t task; |
195 | |
196 | #if TypeCheck1 |
197 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
198 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
199 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
200 | #endif /* TypeCheck */ |
201 | |
202 | #if TypeCheck1 |
203 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
204 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
205 | #endif /* TypeCheck */ |
206 | |
207 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
208 | |
209 | OutP->RetCode = mach_port_type(task, In0P->name, &OutP->ptype); |
210 | space_deallocate(task); |
211 | if (OutP->RetCode != KERN_SUCCESS0) |
212 | return; |
213 | |
214 | OutP->Head.msgh_size = 40; |
215 | |
216 | OutP->ptypeType = ptypeType; |
217 | } |
218 | |
219 | /* Default implementation of mach_port_type */ |
220 | #ifdef MIG_EOPNOTSUPP |
221 | kern_return_t __attribute__ ((weak)) |
222 | mach_port_type |
223 | ( |
224 | ipc_space_t task, |
225 | mach_port_t name, |
226 | mach_port_type_t *ptype |
227 | ) { return MIG_EOPNOTSUPP; } |
228 | #endif /* MIG_EOPNOTSUPP */ |
229 | |
230 | /* Routine mach_port_rename */ |
231 | mig_internalstatic void _Xmach_port_rename |
232 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
233 | { |
234 | typedef struct { |
235 | mach_msg_header_t Head; |
236 | mach_msg_type_t old_nameType; |
237 | mach_port_t old_name; |
238 | mach_msg_type_t new_nameType; |
239 | mach_port_t new_name; |
240 | } Request; |
241 | |
242 | typedef struct { |
243 | mach_msg_header_t Head; |
244 | mach_msg_type_t RetCodeType; |
245 | kern_return_t RetCode; |
246 | } Reply; |
247 | |
248 | Request *In0P = (Request *) InHeadP; |
249 | Reply *OutP = (Reply *) OutHeadP; |
250 | mig_external kern_return_t mach_port_rename |
251 | (ipc_space_t task, mach_port_t old_name, mach_port_t new_name); |
252 | |
253 | const mach_msg_type_t old_nameCheck = { |
254 | /* msgt_name = */ 15, |
255 | /* msgt_size = */ 32, |
256 | /* msgt_number = */ 1, |
257 | /* msgt_inline = */ TRUE((boolean_t) 1), |
258 | /* msgt_longform = */ FALSE((boolean_t) 0), |
259 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
260 | /* msgt_unused = */ 0 |
261 | }; |
262 | |
263 | const mach_msg_type_t new_nameCheck = { |
264 | /* msgt_name = */ 15, |
265 | /* msgt_size = */ 32, |
266 | /* msgt_number = */ 1, |
267 | /* msgt_inline = */ TRUE((boolean_t) 1), |
268 | /* msgt_longform = */ FALSE((boolean_t) 0), |
269 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
270 | /* msgt_unused = */ 0 |
271 | }; |
272 | |
273 | ipc_space_t task; |
274 | |
275 | #if TypeCheck1 |
276 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
277 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
278 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
279 | #endif /* TypeCheck */ |
280 | |
281 | #if TypeCheck1 |
282 | if (BAD_TYPECHECK(&In0P->old_nameType, &old_nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->old_nameType); _c.t = *( &old_nameCheck);_t.w != _c.w; })), 0)) |
283 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
284 | #endif /* TypeCheck */ |
285 | |
286 | #if TypeCheck1 |
287 | if (BAD_TYPECHECK(&In0P->new_nameType, &new_nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->new_nameType); _c.t = *( &new_nameCheck);_t.w != _c.w; })), 0)) |
288 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
289 | #endif /* TypeCheck */ |
290 | |
291 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
292 | |
293 | OutP->RetCode = mach_port_rename(task, In0P->old_name, In0P->new_name); |
294 | space_deallocate(task); |
295 | } |
296 | |
297 | /* Default implementation of mach_port_rename */ |
298 | #ifdef MIG_EOPNOTSUPP |
299 | kern_return_t __attribute__ ((weak)) |
300 | mach_port_rename |
301 | ( |
302 | ipc_space_t task, |
303 | mach_port_t old_name, |
304 | mach_port_t new_name |
305 | ) { return MIG_EOPNOTSUPP; } |
306 | #endif /* MIG_EOPNOTSUPP */ |
307 | |
308 | /* Routine mach_port_allocate_name */ |
309 | mig_internalstatic void _Xmach_port_allocate_name |
310 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
311 | { |
312 | typedef struct { |
313 | mach_msg_header_t Head; |
314 | mach_msg_type_t rightType; |
315 | mach_port_right_t right; |
316 | mach_msg_type_t nameType; |
317 | mach_port_t name; |
318 | } Request; |
319 | |
320 | typedef struct { |
321 | mach_msg_header_t Head; |
322 | mach_msg_type_t RetCodeType; |
323 | kern_return_t RetCode; |
324 | } Reply; |
325 | |
326 | Request *In0P = (Request *) InHeadP; |
327 | Reply *OutP = (Reply *) OutHeadP; |
328 | mig_external kern_return_t mach_port_allocate_name |
329 | (ipc_space_t task, mach_port_right_t right, mach_port_t name); |
330 | |
331 | const mach_msg_type_t rightCheck = { |
332 | /* msgt_name = */ 2, |
333 | /* msgt_size = */ 32, |
334 | /* msgt_number = */ 1, |
335 | /* msgt_inline = */ TRUE((boolean_t) 1), |
336 | /* msgt_longform = */ FALSE((boolean_t) 0), |
337 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
338 | /* msgt_unused = */ 0 |
339 | }; |
340 | |
341 | const mach_msg_type_t nameCheck = { |
342 | /* msgt_name = */ 15, |
343 | /* msgt_size = */ 32, |
344 | /* msgt_number = */ 1, |
345 | /* msgt_inline = */ TRUE((boolean_t) 1), |
346 | /* msgt_longform = */ FALSE((boolean_t) 0), |
347 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
348 | /* msgt_unused = */ 0 |
349 | }; |
350 | |
351 | ipc_space_t task; |
352 | |
353 | #if TypeCheck1 |
354 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
355 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
356 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
357 | #endif /* TypeCheck */ |
358 | |
359 | #if TypeCheck1 |
360 | if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rightType); _c.t = *(& rightCheck);_t.w != _c.w; })), 0)) |
361 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
362 | #endif /* TypeCheck */ |
363 | |
364 | #if TypeCheck1 |
365 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
366 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
367 | #endif /* TypeCheck */ |
368 | |
369 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
370 | |
371 | OutP->RetCode = mach_port_allocate_name(task, In0P->right, In0P->name); |
372 | space_deallocate(task); |
373 | } |
374 | |
375 | /* Default implementation of mach_port_allocate_name */ |
376 | #ifdef MIG_EOPNOTSUPP |
377 | kern_return_t __attribute__ ((weak)) |
378 | mach_port_allocate_name |
379 | ( |
380 | ipc_space_t task, |
381 | mach_port_right_t right, |
382 | mach_port_t name |
383 | ) { return MIG_EOPNOTSUPP; } |
384 | #endif /* MIG_EOPNOTSUPP */ |
385 | |
386 | /* Routine mach_port_allocate */ |
387 | mig_internalstatic void _Xmach_port_allocate |
388 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
389 | { |
390 | typedef struct { |
391 | mach_msg_header_t Head; |
392 | mach_msg_type_t rightType; |
393 | mach_port_right_t right; |
394 | } Request; |
395 | |
396 | typedef struct { |
397 | mach_msg_header_t Head; |
398 | mach_msg_type_t RetCodeType; |
399 | kern_return_t RetCode; |
400 | mach_msg_type_t nameType; |
401 | mach_port_t name; |
402 | } Reply; |
403 | |
404 | Request *In0P = (Request *) InHeadP; |
405 | Reply *OutP = (Reply *) OutHeadP; |
406 | mig_external kern_return_t mach_port_allocate |
407 | (ipc_space_t task, mach_port_right_t right, mach_port_t *name); |
408 | |
409 | const mach_msg_type_t rightCheck = { |
410 | /* msgt_name = */ 2, |
411 | /* msgt_size = */ 32, |
412 | /* msgt_number = */ 1, |
413 | /* msgt_inline = */ TRUE((boolean_t) 1), |
414 | /* msgt_longform = */ FALSE((boolean_t) 0), |
415 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
416 | /* msgt_unused = */ 0 |
417 | }; |
418 | |
419 | const mach_msg_type_t nameType = { |
420 | /* msgt_name = */ 15, |
421 | /* msgt_size = */ 32, |
422 | /* msgt_number = */ 1, |
423 | /* msgt_inline = */ TRUE((boolean_t) 1), |
424 | /* msgt_longform = */ FALSE((boolean_t) 0), |
425 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
426 | /* msgt_unused = */ 0 |
427 | }; |
428 | |
429 | ipc_space_t task; |
430 | |
431 | #if TypeCheck1 |
432 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
433 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
434 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
435 | #endif /* TypeCheck */ |
436 | |
437 | #if TypeCheck1 |
438 | if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rightType); _c.t = *(& rightCheck);_t.w != _c.w; })), 0)) |
439 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
440 | #endif /* TypeCheck */ |
441 | |
442 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
443 | |
444 | OutP->RetCode = mach_port_allocate(task, In0P->right, &OutP->name); |
445 | space_deallocate(task); |
446 | if (OutP->RetCode != KERN_SUCCESS0) |
447 | return; |
448 | |
449 | OutP->Head.msgh_size = 40; |
450 | |
451 | OutP->nameType = nameType; |
452 | } |
453 | |
454 | /* Default implementation of mach_port_allocate */ |
455 | #ifdef MIG_EOPNOTSUPP |
456 | kern_return_t __attribute__ ((weak)) |
457 | mach_port_allocate |
458 | ( |
459 | ipc_space_t task, |
460 | mach_port_right_t right, |
461 | mach_port_t *name |
462 | ) { return MIG_EOPNOTSUPP; } |
463 | #endif /* MIG_EOPNOTSUPP */ |
464 | |
465 | /* Routine mach_port_destroy */ |
466 | mig_internalstatic void _Xmach_port_destroy |
467 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
468 | { |
469 | typedef struct { |
470 | mach_msg_header_t Head; |
471 | mach_msg_type_t nameType; |
472 | mach_port_t name; |
473 | } Request; |
474 | |
475 | typedef struct { |
476 | mach_msg_header_t Head; |
477 | mach_msg_type_t RetCodeType; |
478 | kern_return_t RetCode; |
479 | } Reply; |
480 | |
481 | Request *In0P = (Request *) InHeadP; |
482 | Reply *OutP = (Reply *) OutHeadP; |
483 | mig_external kern_return_t mach_port_destroy |
484 | (ipc_space_t task, mach_port_t name); |
485 | |
486 | const mach_msg_type_t nameCheck = { |
487 | /* msgt_name = */ 15, |
488 | /* msgt_size = */ 32, |
489 | /* msgt_number = */ 1, |
490 | /* msgt_inline = */ TRUE((boolean_t) 1), |
491 | /* msgt_longform = */ FALSE((boolean_t) 0), |
492 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
493 | /* msgt_unused = */ 0 |
494 | }; |
495 | |
496 | ipc_space_t task; |
497 | |
498 | #if TypeCheck1 |
499 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
500 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
501 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
502 | #endif /* TypeCheck */ |
503 | |
504 | #if TypeCheck1 |
505 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
506 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
507 | #endif /* TypeCheck */ |
508 | |
509 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
510 | |
511 | OutP->RetCode = mach_port_destroy(task, In0P->name); |
512 | space_deallocate(task); |
513 | } |
514 | |
515 | /* Default implementation of mach_port_destroy */ |
516 | #ifdef MIG_EOPNOTSUPP |
517 | kern_return_t __attribute__ ((weak)) |
518 | mach_port_destroy |
519 | ( |
520 | ipc_space_t task, |
521 | mach_port_t name |
522 | ) { return MIG_EOPNOTSUPP; } |
523 | #endif /* MIG_EOPNOTSUPP */ |
524 | |
525 | /* Routine mach_port_deallocate */ |
526 | mig_internalstatic void _Xmach_port_deallocate |
527 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
528 | { |
529 | typedef struct { |
530 | mach_msg_header_t Head; |
531 | mach_msg_type_t nameType; |
532 | mach_port_t name; |
533 | } Request; |
534 | |
535 | typedef struct { |
536 | mach_msg_header_t Head; |
537 | mach_msg_type_t RetCodeType; |
538 | kern_return_t RetCode; |
539 | } Reply; |
540 | |
541 | Request *In0P = (Request *) InHeadP; |
542 | Reply *OutP = (Reply *) OutHeadP; |
543 | mig_external kern_return_t mach_port_deallocate |
544 | (ipc_space_t task, mach_port_t name); |
545 | |
546 | const mach_msg_type_t nameCheck = { |
547 | /* msgt_name = */ 15, |
548 | /* msgt_size = */ 32, |
549 | /* msgt_number = */ 1, |
550 | /* msgt_inline = */ TRUE((boolean_t) 1), |
551 | /* msgt_longform = */ FALSE((boolean_t) 0), |
552 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
553 | /* msgt_unused = */ 0 |
554 | }; |
555 | |
556 | ipc_space_t task; |
557 | |
558 | #if TypeCheck1 |
559 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
560 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
561 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
562 | #endif /* TypeCheck */ |
563 | |
564 | #if TypeCheck1 |
565 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
566 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
567 | #endif /* TypeCheck */ |
568 | |
569 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
570 | |
571 | OutP->RetCode = mach_port_deallocate(task, In0P->name); |
572 | space_deallocate(task); |
573 | } |
574 | |
575 | /* Default implementation of mach_port_deallocate */ |
576 | #ifdef MIG_EOPNOTSUPP |
577 | kern_return_t __attribute__ ((weak)) |
578 | mach_port_deallocate |
579 | ( |
580 | ipc_space_t task, |
581 | mach_port_t name |
582 | ) { return MIG_EOPNOTSUPP; } |
583 | #endif /* MIG_EOPNOTSUPP */ |
584 | |
585 | /* Routine mach_port_get_refs */ |
586 | mig_internalstatic void _Xmach_port_get_refs |
587 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
588 | { |
589 | typedef struct { |
590 | mach_msg_header_t Head; |
591 | mach_msg_type_t nameType; |
592 | mach_port_t name; |
593 | mach_msg_type_t rightType; |
594 | mach_port_right_t right; |
595 | } Request; |
596 | |
597 | typedef struct { |
598 | mach_msg_header_t Head; |
599 | mach_msg_type_t RetCodeType; |
600 | kern_return_t RetCode; |
601 | mach_msg_type_t refsType; |
602 | mach_port_urefs_t refs; |
603 | } Reply; |
604 | |
605 | Request *In0P = (Request *) InHeadP; |
606 | Reply *OutP = (Reply *) OutHeadP; |
607 | mig_external kern_return_t mach_port_get_refs |
608 | (ipc_space_t task, mach_port_t name, mach_port_right_t right, mach_port_urefs_t *refs); |
609 | |
610 | const mach_msg_type_t nameCheck = { |
611 | /* msgt_name = */ 15, |
612 | /* msgt_size = */ 32, |
613 | /* msgt_number = */ 1, |
614 | /* msgt_inline = */ TRUE((boolean_t) 1), |
615 | /* msgt_longform = */ FALSE((boolean_t) 0), |
616 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
617 | /* msgt_unused = */ 0 |
618 | }; |
619 | |
620 | const mach_msg_type_t rightCheck = { |
621 | /* msgt_name = */ 2, |
622 | /* msgt_size = */ 32, |
623 | /* msgt_number = */ 1, |
624 | /* msgt_inline = */ TRUE((boolean_t) 1), |
625 | /* msgt_longform = */ FALSE((boolean_t) 0), |
626 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
627 | /* msgt_unused = */ 0 |
628 | }; |
629 | |
630 | const mach_msg_type_t refsType = { |
631 | /* msgt_name = */ 2, |
632 | /* msgt_size = */ 32, |
633 | /* msgt_number = */ 1, |
634 | /* msgt_inline = */ TRUE((boolean_t) 1), |
635 | /* msgt_longform = */ FALSE((boolean_t) 0), |
636 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
637 | /* msgt_unused = */ 0 |
638 | }; |
639 | |
640 | ipc_space_t task; |
641 | |
642 | #if TypeCheck1 |
643 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
644 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
645 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
646 | #endif /* TypeCheck */ |
647 | |
648 | #if TypeCheck1 |
649 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
650 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
651 | #endif /* TypeCheck */ |
652 | |
653 | #if TypeCheck1 |
654 | if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rightType); _c.t = *(& rightCheck);_t.w != _c.w; })), 0)) |
655 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
656 | #endif /* TypeCheck */ |
657 | |
658 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
659 | |
660 | OutP->RetCode = mach_port_get_refs(task, In0P->name, In0P->right, &OutP->refs); |
661 | space_deallocate(task); |
662 | if (OutP->RetCode != KERN_SUCCESS0) |
663 | return; |
664 | |
665 | OutP->Head.msgh_size = 40; |
666 | |
667 | OutP->refsType = refsType; |
668 | } |
669 | |
670 | /* Default implementation of mach_port_get_refs */ |
671 | #ifdef MIG_EOPNOTSUPP |
672 | kern_return_t __attribute__ ((weak)) |
673 | mach_port_get_refs |
674 | ( |
675 | ipc_space_t task, |
676 | mach_port_t name, |
677 | mach_port_right_t right, |
678 | mach_port_urefs_t *refs |
679 | ) { return MIG_EOPNOTSUPP; } |
680 | #endif /* MIG_EOPNOTSUPP */ |
681 | |
682 | /* Routine mach_port_mod_refs */ |
683 | mig_internalstatic void _Xmach_port_mod_refs |
684 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
685 | { |
686 | typedef struct { |
687 | mach_msg_header_t Head; |
688 | mach_msg_type_t nameType; |
689 | mach_port_t name; |
690 | mach_msg_type_t rightType; |
691 | mach_port_right_t right; |
692 | mach_msg_type_t deltaType; |
693 | mach_port_delta_t delta; |
694 | } Request; |
695 | |
696 | typedef struct { |
697 | mach_msg_header_t Head; |
698 | mach_msg_type_t RetCodeType; |
699 | kern_return_t RetCode; |
700 | } Reply; |
701 | |
702 | Request *In0P = (Request *) InHeadP; |
703 | Reply *OutP = (Reply *) OutHeadP; |
704 | mig_external kern_return_t mach_port_mod_refs |
705 | (ipc_space_t task, mach_port_t name, mach_port_right_t right, mach_port_delta_t delta); |
706 | |
707 | const mach_msg_type_t nameCheck = { |
708 | /* msgt_name = */ 15, |
709 | /* msgt_size = */ 32, |
710 | /* msgt_number = */ 1, |
711 | /* msgt_inline = */ TRUE((boolean_t) 1), |
712 | /* msgt_longform = */ FALSE((boolean_t) 0), |
713 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
714 | /* msgt_unused = */ 0 |
715 | }; |
716 | |
717 | const mach_msg_type_t rightCheck = { |
718 | /* msgt_name = */ 2, |
719 | /* msgt_size = */ 32, |
720 | /* msgt_number = */ 1, |
721 | /* msgt_inline = */ TRUE((boolean_t) 1), |
722 | /* msgt_longform = */ FALSE((boolean_t) 0), |
723 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
724 | /* msgt_unused = */ 0 |
725 | }; |
726 | |
727 | const mach_msg_type_t deltaCheck = { |
728 | /* msgt_name = */ 2, |
729 | /* msgt_size = */ 32, |
730 | /* msgt_number = */ 1, |
731 | /* msgt_inline = */ TRUE((boolean_t) 1), |
732 | /* msgt_longform = */ FALSE((boolean_t) 0), |
733 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
734 | /* msgt_unused = */ 0 |
735 | }; |
736 | |
737 | ipc_space_t task; |
738 | |
739 | #if TypeCheck1 |
740 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
741 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
742 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
743 | #endif /* TypeCheck */ |
744 | |
745 | #if TypeCheck1 |
746 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
747 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
748 | #endif /* TypeCheck */ |
749 | |
750 | #if TypeCheck1 |
751 | if (BAD_TYPECHECK(&In0P->rightType, &rightCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->rightType); _c.t = *(& rightCheck);_t.w != _c.w; })), 0)) |
752 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
753 | #endif /* TypeCheck */ |
754 | |
755 | #if TypeCheck1 |
756 | if (BAD_TYPECHECK(&In0P->deltaType, &deltaCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->deltaType); _c.t = *(& deltaCheck);_t.w != _c.w; })), 0)) |
757 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
758 | #endif /* TypeCheck */ |
759 | |
760 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
761 | |
762 | OutP->RetCode = mach_port_mod_refs(task, In0P->name, In0P->right, In0P->delta); |
763 | space_deallocate(task); |
764 | } |
765 | |
766 | /* Default implementation of mach_port_mod_refs */ |
767 | #ifdef MIG_EOPNOTSUPP |
768 | kern_return_t __attribute__ ((weak)) |
769 | mach_port_mod_refs |
770 | ( |
771 | ipc_space_t task, |
772 | mach_port_t name, |
773 | mach_port_right_t right, |
774 | mach_port_delta_t delta |
775 | ) { return MIG_EOPNOTSUPP; } |
776 | #endif /* MIG_EOPNOTSUPP */ |
777 | |
778 | /* Routine mach_port_set_qlimit */ |
779 | mig_internalstatic void _Xmach_port_set_qlimit |
780 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
781 | { |
782 | typedef struct { |
783 | mach_msg_header_t Head; |
784 | mach_msg_type_t nameType; |
785 | mach_port_t name; |
786 | mach_msg_type_t qlimitType; |
787 | mach_port_msgcount_t qlimit; |
788 | } Request; |
789 | |
790 | typedef struct { |
791 | mach_msg_header_t Head; |
792 | mach_msg_type_t RetCodeType; |
793 | kern_return_t RetCode; |
794 | } Reply; |
795 | |
796 | Request *In0P = (Request *) InHeadP; |
797 | Reply *OutP = (Reply *) OutHeadP; |
798 | mig_external kern_return_t mach_port_set_qlimit |
799 | (ipc_space_t task, mach_port_t name, mach_port_msgcount_t qlimit); |
800 | |
801 | const mach_msg_type_t nameCheck = { |
802 | /* msgt_name = */ 15, |
803 | /* msgt_size = */ 32, |
804 | /* msgt_number = */ 1, |
805 | /* msgt_inline = */ TRUE((boolean_t) 1), |
806 | /* msgt_longform = */ FALSE((boolean_t) 0), |
807 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
808 | /* msgt_unused = */ 0 |
809 | }; |
810 | |
811 | const mach_msg_type_t qlimitCheck = { |
812 | /* msgt_name = */ 2, |
813 | /* msgt_size = */ 32, |
814 | /* msgt_number = */ 1, |
815 | /* msgt_inline = */ TRUE((boolean_t) 1), |
816 | /* msgt_longform = */ FALSE((boolean_t) 0), |
817 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
818 | /* msgt_unused = */ 0 |
819 | }; |
820 | |
821 | ipc_space_t task; |
822 | |
823 | #if TypeCheck1 |
824 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
825 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
826 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
827 | #endif /* TypeCheck */ |
828 | |
829 | #if TypeCheck1 |
830 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
831 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
832 | #endif /* TypeCheck */ |
833 | |
834 | #if TypeCheck1 |
835 | if (BAD_TYPECHECK(&In0P->qlimitType, &qlimitCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->qlimitType); _c.t = *(& qlimitCheck);_t.w != _c.w; })), 0)) |
836 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
837 | #endif /* TypeCheck */ |
838 | |
839 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
840 | |
841 | OutP->RetCode = mach_port_set_qlimit(task, In0P->name, In0P->qlimit); |
842 | space_deallocate(task); |
843 | } |
844 | |
845 | /* Default implementation of mach_port_set_qlimit */ |
846 | #ifdef MIG_EOPNOTSUPP |
847 | kern_return_t __attribute__ ((weak)) |
848 | mach_port_set_qlimit |
849 | ( |
850 | ipc_space_t task, |
851 | mach_port_t name, |
852 | mach_port_msgcount_t qlimit |
853 | ) { return MIG_EOPNOTSUPP; } |
854 | #endif /* MIG_EOPNOTSUPP */ |
855 | |
856 | /* Routine mach_port_set_mscount */ |
857 | mig_internalstatic void _Xmach_port_set_mscount |
858 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
859 | { |
860 | typedef struct { |
861 | mach_msg_header_t Head; |
862 | mach_msg_type_t nameType; |
863 | mach_port_t name; |
864 | mach_msg_type_t mscountType; |
865 | mach_port_mscount_t mscount; |
866 | } Request; |
867 | |
868 | typedef struct { |
869 | mach_msg_header_t Head; |
870 | mach_msg_type_t RetCodeType; |
871 | kern_return_t RetCode; |
872 | } Reply; |
873 | |
874 | Request *In0P = (Request *) InHeadP; |
875 | Reply *OutP = (Reply *) OutHeadP; |
876 | mig_external kern_return_t mach_port_set_mscount |
877 | (ipc_space_t task, mach_port_t name, mach_port_mscount_t mscount); |
878 | |
879 | const mach_msg_type_t nameCheck = { |
880 | /* msgt_name = */ 15, |
881 | /* msgt_size = */ 32, |
882 | /* msgt_number = */ 1, |
883 | /* msgt_inline = */ TRUE((boolean_t) 1), |
884 | /* msgt_longform = */ FALSE((boolean_t) 0), |
885 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
886 | /* msgt_unused = */ 0 |
887 | }; |
888 | |
889 | const mach_msg_type_t mscountCheck = { |
890 | /* msgt_name = */ 2, |
891 | /* msgt_size = */ 32, |
892 | /* msgt_number = */ 1, |
893 | /* msgt_inline = */ TRUE((boolean_t) 1), |
894 | /* msgt_longform = */ FALSE((boolean_t) 0), |
895 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
896 | /* msgt_unused = */ 0 |
897 | }; |
898 | |
899 | ipc_space_t task; |
900 | |
901 | #if TypeCheck1 |
902 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
903 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
904 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
905 | #endif /* TypeCheck */ |
906 | |
907 | #if TypeCheck1 |
908 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
909 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
910 | #endif /* TypeCheck */ |
911 | |
912 | #if TypeCheck1 |
913 | if (BAD_TYPECHECK(&In0P->mscountType, &mscountCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->mscountType); _c.t = *(& mscountCheck);_t.w != _c.w; })), 0)) |
914 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
915 | #endif /* TypeCheck */ |
916 | |
917 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
918 | |
919 | OutP->RetCode = mach_port_set_mscount(task, In0P->name, In0P->mscount); |
920 | space_deallocate(task); |
921 | } |
922 | |
923 | /* Default implementation of mach_port_set_mscount */ |
924 | #ifdef MIG_EOPNOTSUPP |
925 | kern_return_t __attribute__ ((weak)) |
926 | mach_port_set_mscount |
927 | ( |
928 | ipc_space_t task, |
929 | mach_port_t name, |
930 | mach_port_mscount_t mscount |
931 | ) { return MIG_EOPNOTSUPP; } |
932 | #endif /* MIG_EOPNOTSUPP */ |
933 | |
934 | /* Routine mach_port_get_set_status */ |
935 | mig_internalstatic void _Xmach_port_get_set_status |
936 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
937 | { |
938 | typedef struct { |
939 | mach_msg_header_t Head; |
940 | mach_msg_type_t nameType; |
941 | mach_port_t name; |
942 | } Request; |
943 | |
944 | typedef struct { |
945 | mach_msg_header_t Head; |
946 | mach_msg_type_t RetCodeType; |
947 | kern_return_t RetCode; |
948 | mach_msg_type_long_t membersType; |
949 | mach_port_array_t members; |
950 | } Reply; |
951 | |
952 | Request *In0P = (Request *) InHeadP; |
953 | Reply *OutP = (Reply *) OutHeadP; |
954 | mig_external kern_return_t mach_port_get_set_status |
955 | (ipc_space_t task, mach_port_t name, mach_port_array_t *members, mach_msg_type_number_t *membersCnt); |
956 | |
957 | const mach_msg_type_t nameCheck = { |
958 | /* msgt_name = */ 15, |
959 | /* msgt_size = */ 32, |
960 | /* msgt_number = */ 1, |
961 | /* msgt_inline = */ TRUE((boolean_t) 1), |
962 | /* msgt_longform = */ FALSE((boolean_t) 0), |
963 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
964 | /* msgt_unused = */ 0 |
965 | }; |
966 | |
967 | const mach_msg_type_long_t membersType = { |
968 | { |
969 | /* msgt_name = */ 0, |
970 | /* msgt_size = */ 0, |
971 | /* msgt_number = */ 0, |
972 | /* msgt_inline = */ FALSE((boolean_t) 0), |
973 | /* msgt_longform = */ TRUE((boolean_t) 1), |
974 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
975 | /* msgt_unused = */ 0 |
976 | }, |
977 | /* msgtl_name = */ 15, |
978 | /* msgtl_size = */ 32, |
979 | /* msgtl_number = */ 0, |
980 | }; |
981 | |
982 | ipc_space_t task; |
983 | mach_msg_type_number_t membersCnt; |
984 | |
985 | #if TypeCheck1 |
986 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
987 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
988 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
989 | #endif /* TypeCheck */ |
990 | |
991 | #if TypeCheck1 |
992 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
993 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
994 | #endif /* TypeCheck */ |
995 | |
996 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
997 | |
998 | OutP->RetCode = mach_port_get_set_status(task, In0P->name, &OutP->members, &membersCnt); |
999 | space_deallocate(task); |
1000 | if (OutP->RetCode != KERN_SUCCESS0) |
1001 | return; |
1002 | |
1003 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1004 | OutP->Head.msgh_size = 48; |
1005 | |
1006 | OutP->membersType = membersType; |
1007 | |
1008 | OutP->membersType.msgtl_number = membersCnt; |
1009 | } |
1010 | |
1011 | /* Default implementation of mach_port_get_set_status */ |
1012 | #ifdef MIG_EOPNOTSUPP |
1013 | kern_return_t __attribute__ ((weak)) |
1014 | mach_port_get_set_status |
1015 | ( |
1016 | ipc_space_t task, |
1017 | mach_port_t name, |
1018 | mach_port_array_t *members, |
1019 | mach_msg_type_number_t *membersCnt |
1020 | ) { return MIG_EOPNOTSUPP; } |
1021 | #endif /* MIG_EOPNOTSUPP */ |
1022 | |
1023 | /* Routine mach_port_move_member */ |
1024 | mig_internalstatic void _Xmach_port_move_member |
1025 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1026 | { |
1027 | typedef struct { |
1028 | mach_msg_header_t Head; |
1029 | mach_msg_type_t memberType; |
1030 | mach_port_t member; |
1031 | mach_msg_type_t afterType; |
1032 | mach_port_t after; |
1033 | } Request; |
1034 | |
1035 | typedef struct { |
1036 | mach_msg_header_t Head; |
1037 | mach_msg_type_t RetCodeType; |
1038 | kern_return_t RetCode; |
1039 | } Reply; |
1040 | |
1041 | Request *In0P = (Request *) InHeadP; |
1042 | Reply *OutP = (Reply *) OutHeadP; |
1043 | mig_external kern_return_t mach_port_move_member |
1044 | (ipc_space_t task, mach_port_t member, mach_port_t after); |
1045 | |
1046 | const mach_msg_type_t memberCheck = { |
1047 | /* msgt_name = */ 15, |
1048 | /* msgt_size = */ 32, |
1049 | /* msgt_number = */ 1, |
1050 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1051 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1052 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1053 | /* msgt_unused = */ 0 |
1054 | }; |
1055 | |
1056 | const mach_msg_type_t afterCheck = { |
1057 | /* msgt_name = */ 15, |
1058 | /* msgt_size = */ 32, |
1059 | /* msgt_number = */ 1, |
1060 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1061 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1062 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1063 | /* msgt_unused = */ 0 |
1064 | }; |
1065 | |
1066 | ipc_space_t task; |
1067 | |
1068 | #if TypeCheck1 |
1069 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1070 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1071 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1072 | #endif /* TypeCheck */ |
1073 | |
1074 | #if TypeCheck1 |
1075 | if (BAD_TYPECHECK(&In0P->memberType, &memberCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->memberType); _c.t = *(& memberCheck);_t.w != _c.w; })), 0)) |
1076 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1077 | #endif /* TypeCheck */ |
1078 | |
1079 | #if TypeCheck1 |
1080 | if (BAD_TYPECHECK(&In0P->afterType, &afterCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->afterType); _c.t = *(& afterCheck);_t.w != _c.w; })), 0)) |
1081 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1082 | #endif /* TypeCheck */ |
1083 | |
1084 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1085 | |
1086 | OutP->RetCode = mach_port_move_member(task, In0P->member, In0P->after); |
1087 | space_deallocate(task); |
1088 | } |
1089 | |
1090 | /* Default implementation of mach_port_move_member */ |
1091 | #ifdef MIG_EOPNOTSUPP |
1092 | kern_return_t __attribute__ ((weak)) |
1093 | mach_port_move_member |
1094 | ( |
1095 | ipc_space_t task, |
1096 | mach_port_t member, |
1097 | mach_port_t after |
1098 | ) { return MIG_EOPNOTSUPP; } |
1099 | #endif /* MIG_EOPNOTSUPP */ |
1100 | |
1101 | /* Routine mach_port_request_notification */ |
1102 | mig_internalstatic void _Xmach_port_request_notification |
1103 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1104 | { |
1105 | typedef struct { |
1106 | mach_msg_header_t Head; |
1107 | mach_msg_type_t nameType; |
1108 | mach_port_t name; |
1109 | mach_msg_type_t idType; |
1110 | mach_msg_id_t id; |
1111 | mach_msg_type_t syncType; |
1112 | mach_port_mscount_t sync; |
1113 | mach_msg_type_t notifyType; |
1114 | ipc_port_t notify; |
1115 | } Request; |
1116 | |
1117 | typedef struct { |
1118 | mach_msg_header_t Head; |
1119 | mach_msg_type_t RetCodeType; |
1120 | kern_return_t RetCode; |
1121 | mach_msg_type_t previousType; |
1122 | ipc_port_t previous; |
1123 | } Reply; |
1124 | |
1125 | Request *In0P = (Request *) InHeadP; |
1126 | Reply *OutP = (Reply *) OutHeadP; |
1127 | mig_external kern_return_t mach_port_request_notification |
1128 | (ipc_space_t task, mach_port_t name, mach_msg_id_t id, mach_port_mscount_t sync, ipc_port_t notify, ipc_port_t *previous); |
1129 | |
1130 | const mach_msg_type_t nameCheck = { |
1131 | /* msgt_name = */ 15, |
1132 | /* msgt_size = */ 32, |
1133 | /* msgt_number = */ 1, |
1134 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1135 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1136 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1137 | /* msgt_unused = */ 0 |
1138 | }; |
1139 | |
1140 | const mach_msg_type_t idCheck = { |
1141 | /* msgt_name = */ 2, |
1142 | /* msgt_size = */ 32, |
1143 | /* msgt_number = */ 1, |
1144 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1145 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1146 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1147 | /* msgt_unused = */ 0 |
1148 | }; |
1149 | |
1150 | const mach_msg_type_t syncCheck = { |
1151 | /* msgt_name = */ 2, |
1152 | /* msgt_size = */ 32, |
1153 | /* msgt_number = */ 1, |
1154 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1155 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1156 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1157 | /* msgt_unused = */ 0 |
1158 | }; |
1159 | |
1160 | const mach_msg_type_t previousType = { |
1161 | /* msgt_name = */ 18, |
1162 | /* msgt_size = */ 32, |
1163 | /* msgt_number = */ 1, |
1164 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1165 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1166 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1167 | /* msgt_unused = */ 0 |
1168 | }; |
1169 | |
1170 | ipc_space_t task; |
1171 | |
1172 | #if TypeCheck1 |
1173 | if (mig_unlikely ((In0P->Head.msgh_size != 56) ||__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1174 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1175 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1176 | #endif /* TypeCheck */ |
1177 | |
1178 | #if TypeCheck1 |
1179 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1180 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1181 | #endif /* TypeCheck */ |
1182 | |
1183 | #if TypeCheck1 |
1184 | if (BAD_TYPECHECK(&In0P->idType, &idCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->idType); _c.t = *(&idCheck );_t.w != _c.w; })), 0)) |
1185 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1186 | #endif /* TypeCheck */ |
1187 | |
1188 | #if TypeCheck1 |
1189 | if (BAD_TYPECHECK(&In0P->syncType, &syncCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->syncType); _c.t = *(& syncCheck);_t.w != _c.w; })), 0)) |
1190 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1191 | #endif /* TypeCheck */ |
1192 | |
1193 | #if TypeCheck1 |
1194 | if (mig_unlikely ((In0P->notifyType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->notifyType.msgt_inline != ((boolean_t ) 1)) || (In0P->notifyType.msgt_longform != ((boolean_t) 0 )) || (In0P->notifyType.msgt_name != 18) || (In0P->notifyType .msgt_number != 1) || (In0P->notifyType.msgt_size != 32)), 0) |
1195 | (In0P->notifyType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->notifyType.msgt_inline != ((boolean_t ) 1)) || (In0P->notifyType.msgt_longform != ((boolean_t) 0 )) || (In0P->notifyType.msgt_name != 18) || (In0P->notifyType .msgt_number != 1) || (In0P->notifyType.msgt_size != 32)), 0) |
1196 | (In0P->notifyType.msgt_name != 18) ||__builtin_expect (!! ((In0P->notifyType.msgt_inline != ((boolean_t ) 1)) || (In0P->notifyType.msgt_longform != ((boolean_t) 0 )) || (In0P->notifyType.msgt_name != 18) || (In0P->notifyType .msgt_number != 1) || (In0P->notifyType.msgt_size != 32)), 0) |
1197 | (In0P->notifyType.msgt_number != 1) ||__builtin_expect (!! ((In0P->notifyType.msgt_inline != ((boolean_t ) 1)) || (In0P->notifyType.msgt_longform != ((boolean_t) 0 )) || (In0P->notifyType.msgt_name != 18) || (In0P->notifyType .msgt_number != 1) || (In0P->notifyType.msgt_size != 32)), 0) |
1198 | (In0P->notifyType.msgt_size != 32))__builtin_expect (!! ((In0P->notifyType.msgt_inline != ((boolean_t ) 1)) || (In0P->notifyType.msgt_longform != ((boolean_t) 0 )) || (In0P->notifyType.msgt_name != 18) || (In0P->notifyType .msgt_number != 1) || (In0P->notifyType.msgt_size != 32)), 0)) |
1199 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1200 | #endif /* TypeCheck */ |
1201 | |
1202 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1203 | |
1204 | OutP->RetCode = mach_port_request_notification(task, In0P->name, In0P->id, In0P->sync, In0P->notify, &OutP->previous); |
1205 | space_deallocate(task); |
1206 | if (OutP->RetCode != KERN_SUCCESS0) |
1207 | return; |
1208 | |
1209 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1210 | OutP->Head.msgh_size = 40; |
1211 | |
1212 | OutP->previousType = previousType; |
1213 | } |
1214 | |
1215 | /* Default implementation of mach_port_request_notification */ |
1216 | #ifdef MIG_EOPNOTSUPP |
1217 | kern_return_t __attribute__ ((weak)) |
1218 | mach_port_request_notification |
1219 | ( |
1220 | ipc_space_t task, |
1221 | mach_port_t name, |
1222 | mach_msg_id_t id, |
1223 | mach_port_mscount_t sync, |
1224 | ipc_port_t notify, |
1225 | ipc_port_t *previous |
1226 | ) { return MIG_EOPNOTSUPP; } |
1227 | #endif /* MIG_EOPNOTSUPP */ |
1228 | |
1229 | /* Routine mach_port_insert_right */ |
1230 | mig_internalstatic void _Xmach_port_insert_right |
1231 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1232 | { |
1233 | typedef struct { |
1234 | mach_msg_header_t Head; |
1235 | mach_msg_type_t nameType; |
1236 | mach_port_t name; |
1237 | mach_msg_type_t polyType; |
1238 | ipc_port_t poly; |
1239 | } Request; |
1240 | |
1241 | typedef struct { |
1242 | mach_msg_header_t Head; |
1243 | mach_msg_type_t RetCodeType; |
1244 | kern_return_t RetCode; |
1245 | } Reply; |
1246 | |
1247 | Request *In0P = (Request *) InHeadP; |
1248 | Reply *OutP = (Reply *) OutHeadP; |
1249 | mig_external kern_return_t mach_port_insert_right |
1250 | (ipc_space_t task, mach_port_t name, ipc_port_t poly, mach_msg_type_name_t polyPoly); |
1251 | |
1252 | #if TypeCheck1 |
1253 | boolean_t msgh_simple = msgh_simple; |
1254 | #endif /* TypeCheck */ |
1255 | |
1256 | const mach_msg_type_t nameCheck = { |
1257 | /* msgt_name = */ 15, |
1258 | /* msgt_size = */ 32, |
1259 | /* msgt_number = */ 1, |
1260 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1261 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1262 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1263 | /* msgt_unused = */ 0 |
1264 | }; |
1265 | |
1266 | ipc_space_t task; |
1267 | |
1268 | #if TypeCheck1 |
1269 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
1270 | if (mig_unlikely ((In0P->Head.msgh_size != 40))__builtin_expect (!! ((In0P->Head.msgh_size != 40)), 0)) |
1271 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1272 | #endif /* TypeCheck */ |
1273 | |
1274 | #if TypeCheck1 |
1275 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1276 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1277 | #endif /* TypeCheck */ |
1278 | |
1279 | #if TypeCheck1 |
1280 | if (mig_unlikely ((In0P->polyType.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->polyType.msgt_inline != ((boolean_t ) 1)) || (In0P->polyType.msgt_longform != ((boolean_t) 0)) || ((((In0P->polyType.msgt_name) >= 16) && ((In0P ->polyType.msgt_name) <= 21)) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)), 0) |
1281 | (In0P->polyType.msgt_longform != FALSE) ||__builtin_expect (!! ((In0P->polyType.msgt_inline != ((boolean_t ) 1)) || (In0P->polyType.msgt_longform != ((boolean_t) 0)) || ((((In0P->polyType.msgt_name) >= 16) && ((In0P ->polyType.msgt_name) <= 21)) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)), 0) |
1282 | (MACH_MSG_TYPE_PORT_ANY(In0P->polyType.msgt_name) && msgh_simple) ||__builtin_expect (!! ((In0P->polyType.msgt_inline != ((boolean_t ) 1)) || (In0P->polyType.msgt_longform != ((boolean_t) 0)) || ((((In0P->polyType.msgt_name) >= 16) && ((In0P ->polyType.msgt_name) <= 21)) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)), 0) |
1283 | (In0P->polyType.msgt_number != 1) ||__builtin_expect (!! ((In0P->polyType.msgt_inline != ((boolean_t ) 1)) || (In0P->polyType.msgt_longform != ((boolean_t) 0)) || ((((In0P->polyType.msgt_name) >= 16) && ((In0P ->polyType.msgt_name) <= 21)) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)), 0) |
1284 | (In0P->polyType.msgt_size != 32))__builtin_expect (!! ((In0P->polyType.msgt_inline != ((boolean_t ) 1)) || (In0P->polyType.msgt_longform != ((boolean_t) 0)) || ((((In0P->polyType.msgt_name) >= 16) && ((In0P ->polyType.msgt_name) <= 21)) && msgh_simple) || (In0P->polyType.msgt_number != 1) || (In0P->polyType.msgt_size != 32)), 0)) |
1285 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1286 | #endif /* TypeCheck */ |
1287 | |
1288 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1289 | |
1290 | OutP->RetCode = mach_port_insert_right(task, In0P->name, In0P->poly, In0P->polyType.msgt_name); |
1291 | space_deallocate(task); |
1292 | } |
1293 | |
1294 | /* Default implementation of mach_port_insert_right */ |
1295 | #ifdef MIG_EOPNOTSUPP |
1296 | kern_return_t __attribute__ ((weak)) |
1297 | mach_port_insert_right |
1298 | ( |
1299 | ipc_space_t task, |
1300 | mach_port_t name, |
1301 | ipc_port_t poly, |
1302 | mach_msg_type_name_t polyPoly |
1303 | ) { return MIG_EOPNOTSUPP; } |
1304 | #endif /* MIG_EOPNOTSUPP */ |
1305 | |
1306 | /* Routine mach_port_extract_right */ |
1307 | mig_internalstatic void _Xmach_port_extract_right |
1308 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1309 | { |
1310 | typedef struct { |
1311 | mach_msg_header_t Head; |
1312 | mach_msg_type_t nameType; |
1313 | mach_port_t name; |
1314 | mach_msg_type_t msgt_nameType; |
1315 | mach_msg_type_name_t msgt_name; |
1316 | } Request; |
1317 | |
1318 | typedef struct { |
1319 | mach_msg_header_t Head; |
1320 | mach_msg_type_t RetCodeType; |
1321 | kern_return_t RetCode; |
1322 | mach_msg_type_t polyType; |
1323 | ipc_port_t poly; |
1324 | } Reply; |
1325 | |
1326 | Request *In0P = (Request *) InHeadP; |
1327 | Reply *OutP = (Reply *) OutHeadP; |
1328 | mig_external kern_return_t mach_port_extract_right |
1329 | (ipc_space_t task, mach_port_t name, mach_msg_type_name_t msgt_name, ipc_port_t *poly, mach_msg_type_name_t *polyPoly); |
1330 | |
1331 | boolean_t msgh_simple = msgh_simple; |
Assigned value is garbage or undefined | |
1332 | const mach_msg_type_t nameCheck = { |
1333 | /* msgt_name = */ 15, |
1334 | /* msgt_size = */ 32, |
1335 | /* msgt_number = */ 1, |
1336 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1337 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1338 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1339 | /* msgt_unused = */ 0 |
1340 | }; |
1341 | |
1342 | const mach_msg_type_t msgt_nameCheck = { |
1343 | /* msgt_name = */ 2, |
1344 | /* msgt_size = */ 32, |
1345 | /* msgt_number = */ 1, |
1346 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1347 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1348 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1349 | /* msgt_unused = */ 0 |
1350 | }; |
1351 | |
1352 | const mach_msg_type_t polyType = { |
1353 | /* msgt_name = */ -1, |
1354 | /* msgt_size = */ 32, |
1355 | /* msgt_number = */ 1, |
1356 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1357 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1358 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1359 | /* msgt_unused = */ 0 |
1360 | }; |
1361 | |
1362 | ipc_space_t task; |
1363 | mach_msg_type_name_t polyPoly; |
1364 | |
1365 | #if TypeCheck1 |
1366 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1367 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1368 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1369 | #endif /* TypeCheck */ |
1370 | |
1371 | #if TypeCheck1 |
1372 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1373 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1374 | #endif /* TypeCheck */ |
1375 | |
1376 | #if TypeCheck1 |
1377 | if (BAD_TYPECHECK(&In0P->msgt_nameType, &msgt_nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->msgt_nameType); _c.t = * (&msgt_nameCheck);_t.w != _c.w; })), 0)) |
1378 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1379 | #endif /* TypeCheck */ |
1380 | |
1381 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1382 | |
1383 | OutP->RetCode = mach_port_extract_right(task, In0P->name, In0P->msgt_name, &OutP->poly, &polyPoly); |
1384 | space_deallocate(task); |
1385 | if (OutP->RetCode != KERN_SUCCESS0) |
1386 | return; |
1387 | |
1388 | msgh_simple = TRUE((boolean_t) 1); |
1389 | OutP->Head.msgh_size = 40; |
1390 | |
1391 | OutP->polyType = polyType; |
1392 | |
1393 | if (polyPoly == MACH_MSG_TYPE_PORT_RECEIVE16) |
1394 | if (IP_VALID((ipc_port_t) InHeadP->msgh_reply_port)(((&((ipc_port_t) InHeadP->msgh_local_port)->ip_target .ipt_object) != ((ipc_object_t) 0)) && ((&((ipc_port_t ) InHeadP->msgh_local_port)->ip_target.ipt_object) != ( (ipc_object_t) -1))) && |
1395 | IP_VALID((ipc_port_t) OutP->poly)(((&((ipc_port_t) OutP->poly)->ip_target.ipt_object ) != ((ipc_object_t) 0)) && ((&((ipc_port_t) OutP ->poly)->ip_target.ipt_object) != ((ipc_object_t) -1))) && |
1396 | ipc_port_check_circularity((ipc_port_t) OutP->poly, (ipc_port_t) InHeadP->msgh_reply_portmsgh_local_port)) |
1397 | OutHeadP->msgh_bits |= MACH_MSGH_BITS_CIRCULAR0x40000000; |
1398 | |
1399 | if (MACH_MSG_TYPE_PORT_ANY(polyPoly)(((polyPoly) >= 16) && ((polyPoly) <= 21))) |
1400 | msgh_simple = FALSE((boolean_t) 0); |
1401 | |
1402 | OutP->polyType.msgt_name = polyPoly; |
1403 | |
1404 | if (!msgh_simple) |
1405 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1406 | } |
1407 | |
1408 | /* Default implementation of mach_port_extract_right */ |
1409 | #ifdef MIG_EOPNOTSUPP |
1410 | kern_return_t __attribute__ ((weak)) |
1411 | mach_port_extract_right |
1412 | ( |
1413 | ipc_space_t task, |
1414 | mach_port_t name, |
1415 | mach_msg_type_name_t msgt_name, |
1416 | ipc_port_t *poly, |
1417 | mach_msg_type_name_t *polyPoly |
1418 | ) { return MIG_EOPNOTSUPP; } |
1419 | #endif /* MIG_EOPNOTSUPP */ |
1420 | |
1421 | /* Routine mach_port_get_receive_status */ |
1422 | mig_internalstatic void _Xmach_port_get_receive_status |
1423 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1424 | { |
1425 | typedef struct { |
1426 | mach_msg_header_t Head; |
1427 | mach_msg_type_t nameType; |
1428 | mach_port_t name; |
1429 | } Request; |
1430 | |
1431 | typedef struct { |
1432 | mach_msg_header_t Head; |
1433 | mach_msg_type_t RetCodeType; |
1434 | kern_return_t RetCode; |
1435 | mach_msg_type_t statusType; |
1436 | mach_port_status_t status; |
1437 | } Reply; |
1438 | |
1439 | Request *In0P = (Request *) InHeadP; |
1440 | Reply *OutP = (Reply *) OutHeadP; |
1441 | mig_external kern_return_t mach_port_get_receive_status |
1442 | (ipc_space_t task, mach_port_t name, mach_port_status_t *status); |
1443 | |
1444 | const mach_msg_type_t nameCheck = { |
1445 | /* msgt_name = */ 15, |
1446 | /* msgt_size = */ 32, |
1447 | /* msgt_number = */ 1, |
1448 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1449 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1450 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1451 | /* msgt_unused = */ 0 |
1452 | }; |
1453 | |
1454 | const mach_msg_type_t statusType = { |
1455 | /* msgt_name = */ 2, |
1456 | /* msgt_size = */ 32, |
1457 | /* msgt_number = */ 9, |
1458 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1459 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1460 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1461 | /* msgt_unused = */ 0 |
1462 | }; |
1463 | |
1464 | ipc_space_t task; |
1465 | |
1466 | #if TypeCheck1 |
1467 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1468 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1469 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1470 | #endif /* TypeCheck */ |
1471 | |
1472 | #if TypeCheck1 |
1473 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1474 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1475 | #endif /* TypeCheck */ |
1476 | |
1477 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1478 | |
1479 | OutP->RetCode = mach_port_get_receive_status(task, In0P->name, &OutP->status); |
1480 | space_deallocate(task); |
1481 | if (OutP->RetCode != KERN_SUCCESS0) |
1482 | return; |
1483 | |
1484 | OutP->Head.msgh_size = 72; |
1485 | |
1486 | OutP->statusType = statusType; |
1487 | } |
1488 | |
1489 | /* Default implementation of mach_port_get_receive_status */ |
1490 | #ifdef MIG_EOPNOTSUPP |
1491 | kern_return_t __attribute__ ((weak)) |
1492 | mach_port_get_receive_status |
1493 | ( |
1494 | ipc_space_t task, |
1495 | mach_port_t name, |
1496 | mach_port_status_t *status |
1497 | ) { return MIG_EOPNOTSUPP; } |
1498 | #endif /* MIG_EOPNOTSUPP */ |
1499 | |
1500 | /* Routine mach_port_set_seqno */ |
1501 | mig_internalstatic void _Xmach_port_set_seqno |
1502 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1503 | { |
1504 | typedef struct { |
1505 | mach_msg_header_t Head; |
1506 | mach_msg_type_t nameType; |
1507 | mach_port_t name; |
1508 | mach_msg_type_t seqnoType; |
1509 | mach_port_seqno_t seqno; |
1510 | } Request; |
1511 | |
1512 | typedef struct { |
1513 | mach_msg_header_t Head; |
1514 | mach_msg_type_t RetCodeType; |
1515 | kern_return_t RetCode; |
1516 | } Reply; |
1517 | |
1518 | Request *In0P = (Request *) InHeadP; |
1519 | Reply *OutP = (Reply *) OutHeadP; |
1520 | mig_external kern_return_t mach_port_set_seqno |
1521 | (ipc_space_t task, mach_port_t name, mach_port_seqno_t seqno); |
1522 | |
1523 | const mach_msg_type_t nameCheck = { |
1524 | /* msgt_name = */ 15, |
1525 | /* msgt_size = */ 32, |
1526 | /* msgt_number = */ 1, |
1527 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1528 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1529 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1530 | /* msgt_unused = */ 0 |
1531 | }; |
1532 | |
1533 | const mach_msg_type_t seqnoCheck = { |
1534 | /* msgt_name = */ 2, |
1535 | /* msgt_size = */ 32, |
1536 | /* msgt_number = */ 1, |
1537 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1538 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1539 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1540 | /* msgt_unused = */ 0 |
1541 | }; |
1542 | |
1543 | ipc_space_t task; |
1544 | |
1545 | #if TypeCheck1 |
1546 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1547 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1548 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1549 | #endif /* TypeCheck */ |
1550 | |
1551 | #if TypeCheck1 |
1552 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1553 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1554 | #endif /* TypeCheck */ |
1555 | |
1556 | #if TypeCheck1 |
1557 | if (BAD_TYPECHECK(&In0P->seqnoType, &seqnoCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->seqnoType); _c.t = *(& seqnoCheck);_t.w != _c.w; })), 0)) |
1558 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1559 | #endif /* TypeCheck */ |
1560 | |
1561 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1562 | |
1563 | OutP->RetCode = mach_port_set_seqno(task, In0P->name, In0P->seqno); |
1564 | space_deallocate(task); |
1565 | } |
1566 | |
1567 | /* Default implementation of mach_port_set_seqno */ |
1568 | #ifdef MIG_EOPNOTSUPP |
1569 | kern_return_t __attribute__ ((weak)) |
1570 | mach_port_set_seqno |
1571 | ( |
1572 | ipc_space_t task, |
1573 | mach_port_t name, |
1574 | mach_port_seqno_t seqno |
1575 | ) { return MIG_EOPNOTSUPP; } |
1576 | #endif /* MIG_EOPNOTSUPP */ |
1577 | |
1578 | /* Routine mach_port_set_protected_payload */ |
1579 | mig_internalstatic void _Xmach_port_set_protected_payload |
1580 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1581 | { |
1582 | typedef struct { |
1583 | mach_msg_header_t Head; |
1584 | mach_msg_type_t nameType; |
1585 | mach_port_t name; |
1586 | mach_msg_type_t payloadType; |
1587 | natural_t payload; |
1588 | } Request; |
1589 | |
1590 | typedef struct { |
1591 | mach_msg_header_t Head; |
1592 | mach_msg_type_t RetCodeType; |
1593 | kern_return_t RetCode; |
1594 | } Reply; |
1595 | |
1596 | Request *In0P = (Request *) InHeadP; |
1597 | Reply *OutP = (Reply *) OutHeadP; |
1598 | mig_external kern_return_t mach_port_set_protected_payload |
1599 | (ipc_space_t task, mach_port_t name, natural_t payload); |
1600 | |
1601 | const mach_msg_type_t nameCheck = { |
1602 | /* msgt_name = */ 15, |
1603 | /* msgt_size = */ 32, |
1604 | /* msgt_number = */ 1, |
1605 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1606 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1607 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1608 | /* msgt_unused = */ 0 |
1609 | }; |
1610 | |
1611 | const mach_msg_type_t payloadCheck = { |
1612 | /* msgt_name = */ 2, |
1613 | /* msgt_size = */ 32, |
1614 | /* msgt_number = */ 1, |
1615 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1616 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1617 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1618 | /* msgt_unused = */ 0 |
1619 | }; |
1620 | |
1621 | ipc_space_t task; |
1622 | |
1623 | #if TypeCheck1 |
1624 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1625 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1626 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1627 | #endif /* TypeCheck */ |
1628 | |
1629 | #if TypeCheck1 |
1630 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1631 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1632 | #endif /* TypeCheck */ |
1633 | |
1634 | #if TypeCheck1 |
1635 | if (BAD_TYPECHECK(&In0P->payloadType, &payloadCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->payloadType); _c.t = *(& payloadCheck);_t.w != _c.w; })), 0)) |
1636 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1637 | #endif /* TypeCheck */ |
1638 | |
1639 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1640 | |
1641 | OutP->RetCode = mach_port_set_protected_payload(task, In0P->name, In0P->payload); |
1642 | space_deallocate(task); |
1643 | } |
1644 | |
1645 | /* Default implementation of mach_port_set_protected_payload */ |
1646 | #ifdef MIG_EOPNOTSUPP |
1647 | kern_return_t __attribute__ ((weak)) |
1648 | mach_port_set_protected_payload |
1649 | ( |
1650 | ipc_space_t task, |
1651 | mach_port_t name, |
1652 | natural_t payload |
1653 | ) { return MIG_EOPNOTSUPP; } |
1654 | #endif /* MIG_EOPNOTSUPP */ |
1655 | |
1656 | /* Routine mach_port_clear_protected_payload */ |
1657 | mig_internalstatic void _Xmach_port_clear_protected_payload |
1658 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1659 | { |
1660 | typedef struct { |
1661 | mach_msg_header_t Head; |
1662 | mach_msg_type_t nameType; |
1663 | mach_port_t name; |
1664 | } Request; |
1665 | |
1666 | typedef struct { |
1667 | mach_msg_header_t Head; |
1668 | mach_msg_type_t RetCodeType; |
1669 | kern_return_t RetCode; |
1670 | } Reply; |
1671 | |
1672 | Request *In0P = (Request *) InHeadP; |
1673 | Reply *OutP = (Reply *) OutHeadP; |
1674 | mig_external kern_return_t mach_port_clear_protected_payload |
1675 | (ipc_space_t task, mach_port_t name); |
1676 | |
1677 | const mach_msg_type_t nameCheck = { |
1678 | /* msgt_name = */ 15, |
1679 | /* msgt_size = */ 32, |
1680 | /* msgt_number = */ 1, |
1681 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1682 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1683 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1684 | /* msgt_unused = */ 0 |
1685 | }; |
1686 | |
1687 | ipc_space_t task; |
1688 | |
1689 | #if TypeCheck1 |
1690 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1691 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1692 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1693 | #endif /* TypeCheck */ |
1694 | |
1695 | #if TypeCheck1 |
1696 | if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(& nameCheck);_t.w != _c.w; })), 0)) |
1697 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1698 | #endif /* TypeCheck */ |
1699 | |
1700 | task = convert_port_to_space((ipc_port_t) In0P->Head.msgh_request_portmsgh_remote_port); |
1701 | |
1702 | OutP->RetCode = mach_port_clear_protected_payload(task, In0P->name); |
1703 | space_deallocate(task); |
1704 | } |
1705 | |
1706 | /* Default implementation of mach_port_clear_protected_payload */ |
1707 | #ifdef MIG_EOPNOTSUPP |
1708 | kern_return_t __attribute__ ((weak)) |
1709 | mach_port_clear_protected_payload |
1710 | ( |
1711 | ipc_space_t task, |
1712 | mach_port_t name |
1713 | ) { return MIG_EOPNOTSUPP; } |
1714 | #endif /* MIG_EOPNOTSUPP */ |
1715 | |
1716 | mig_routine_t mach_port_server_routines[] = { |
1717 | _Xmach_port_names, |
1718 | _Xmach_port_type, |
1719 | _Xmach_port_rename, |
1720 | _Xmach_port_allocate_name, |
1721 | _Xmach_port_allocate, |
1722 | _Xmach_port_destroy, |
1723 | _Xmach_port_deallocate, |
1724 | _Xmach_port_get_refs, |
1725 | _Xmach_port_mod_refs, |
1726 | 0, |
1727 | _Xmach_port_set_qlimit, |
1728 | _Xmach_port_set_mscount, |
1729 | _Xmach_port_get_set_status, |
1730 | _Xmach_port_move_member, |
1731 | _Xmach_port_request_notification, |
1732 | _Xmach_port_insert_right, |
1733 | _Xmach_port_extract_right, |
1734 | _Xmach_port_get_receive_status, |
1735 | _Xmach_port_set_seqno, |
1736 | 0, |
1737 | 0, |
1738 | _Xmach_port_set_protected_payload, |
1739 | _Xmach_port_clear_protected_payload, |
1740 | }; |
1741 | |
1742 | mig_external boolean_t mach_port_server |
1743 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1744 | { |
1745 | mach_msg_header_t *InP = InHeadP; |
1746 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
1747 | |
1748 | const mach_msg_type_t RetCodeType = { |
1749 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
1750 | /* msgt_size = */ 32, |
1751 | /* msgt_number = */ 1, |
1752 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1753 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1754 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1755 | /* msgt_unused = */ 0 |
1756 | }; |
1757 | |
1758 | mig_routine_t routine; |
1759 | |
1760 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)(((((InP->msgh_bits) & 0x0000ff00) >> 8)) | ((0) << 8)); |
1761 | OutP->Head.msgh_size = sizeof *OutP; |
1762 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_local_port; |
1763 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
1764 | OutP->Head.msgh_seqno = 0; |
1765 | OutP->Head.msgh_id = InP->msgh_id + 100; |
1766 | |
1767 | OutP->RetCodeType = RetCodeType; |
1768 | |
1769 | if ((InP->msgh_id > 3222) || (InP->msgh_id < 3200) || |
1770 | ((routine = mach_port_server_routines[InP->msgh_id - 3200]) == 0)) { |
1771 | OutP->RetCode = MIG_BAD_ID-303; |
1772 | return FALSE((boolean_t) 0); |
1773 | } |
1774 | (*routine) (InP, &OutP->Head); |
1775 | return TRUE((boolean_t) 1); |
1776 | } |
1777 | |
1778 | mig_external mig_routine_t mach_port_server_routine |
1779 | (const mach_msg_header_t *InHeadP) |
1780 | { |
1781 | int msgh_id; |
1782 | |
1783 | msgh_id = InHeadP->msgh_id - 3200; |
1784 | |
1785 | if ((msgh_id > 22) || (msgh_id < 0)) |
1786 | return 0; |
1787 | |
1788 | return mach_port_server_routines[msgh_id]; |
1789 | } |
1790 |