File: | obj-scan-build/trans/msgServer.c |
Location: | line 1865, column 12 |
Description: | Value stored to 'msgh_simple' during its initialization is never read |
1 | /* Module msg */ |
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 | |
14 | #ifndef mig_internalstatic |
15 | #define mig_internalstatic static |
16 | #endif |
17 | |
18 | #ifndef mig_external |
19 | #define mig_external |
20 | #endif |
21 | |
22 | #ifndef mig_unlikely |
23 | #define mig_unlikely(X)__builtin_expect (!! (X), 0) __builtin_expect (!! (X), 0) |
24 | #endif |
25 | |
26 | #ifndef TypeCheck1 |
27 | #define TypeCheck1 1 |
28 | #endif |
29 | |
30 | #ifndef UseExternRCSId1 |
31 | #define UseExternRCSId1 1 |
32 | #endif |
33 | |
34 | #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) |
35 | 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) |
36 | _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) |
37 | #define msgh_request_portmsgh_local_port msgh_local_port |
38 | #define MACH_MSGH_BITS_REQUEST(bits)(((bits) & 0x0000ff00) >> 8) MACH_MSGH_BITS_LOCAL(bits)(((bits) & 0x0000ff00) >> 8) |
39 | #define msgh_reply_portmsgh_remote_port msgh_remote_port |
40 | #define MACH_MSGH_BITS_REPLY(bits)((bits) & 0x000000ff) MACH_MSGH_BITS_REMOTE(bits)((bits) & 0x000000ff) |
41 | |
42 | #include <hurd/ports.h> |
43 | #include <mach/std_types.h> |
44 | #include <mach/mach_types.h> |
45 | #include <device/device_types.h> |
46 | #include <device/net_status.h> |
47 | #include <sys/types.h> |
48 | #include <sys/stat.h> |
49 | #include <sys/statfs.h> |
50 | #include <sys/resource.h> |
51 | #include <sys/utsname.h> |
52 | #include <hurd/hurd_types.h> |
53 | |
54 | /* Routine msg_sig_post */ |
55 | mig_internalstatic void _Xmsg_sig_post |
56 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
57 | { |
58 | typedef struct { |
59 | mach_msg_header_t Head; |
60 | mach_msg_type_t signalType; |
61 | int signal; |
62 | mach_msg_type_t sigcodeType; |
63 | natural_t sigcode; |
64 | mach_msg_type_t refportType; |
65 | mach_port_t refport; |
66 | } Request; |
67 | |
68 | typedef struct { |
69 | mach_msg_header_t Head; |
70 | mach_msg_type_t RetCodeType; |
71 | kern_return_t RetCode; |
72 | } Reply; |
73 | |
74 | Request *In0P = (Request *) InHeadP; |
75 | Reply *OutP = (Reply *) OutHeadP; |
76 | mig_external kern_return_t S_msg_sig_post |
77 | (mach_port_t process, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, int signal, natural_t sigcode, mach_port_t refport); |
78 | |
79 | const mach_msg_type_t signalCheck = { |
80 | /* msgt_name = */ 2, |
81 | /* msgt_size = */ 32, |
82 | /* msgt_number = */ 1, |
83 | /* msgt_inline = */ TRUE((boolean_t) 1), |
84 | /* msgt_longform = */ FALSE((boolean_t) 0), |
85 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
86 | /* msgt_unused = */ 0 |
87 | }; |
88 | |
89 | const mach_msg_type_t sigcodeCheck = { |
90 | /* msgt_name = */ 2, |
91 | /* msgt_size = */ 32, |
92 | /* msgt_number = */ 1, |
93 | /* msgt_inline = */ TRUE((boolean_t) 1), |
94 | /* msgt_longform = */ FALSE((boolean_t) 0), |
95 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
96 | /* msgt_unused = */ 0 |
97 | }; |
98 | |
99 | const mach_msg_type_t refportCheck = { |
100 | /* msgt_name = */ 17, |
101 | /* msgt_size = */ 32, |
102 | /* msgt_number = */ 1, |
103 | /* msgt_inline = */ TRUE((boolean_t) 1), |
104 | /* msgt_longform = */ FALSE((boolean_t) 0), |
105 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
106 | /* msgt_unused = */ 0 |
107 | }; |
108 | |
109 | mach_port_t process; |
110 | mach_port_t reply_port; |
111 | mach_port_t refport; |
112 | |
113 | #if TypeCheck1 |
114 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
115 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
116 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
117 | #endif /* TypeCheck */ |
118 | |
119 | #if TypeCheck1 |
120 | if (BAD_TYPECHECK(&In0P->signalType, &signalCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->signalType); _c.t = *(& signalCheck);_t.w != _c.w; })), 0)) |
121 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
122 | #endif /* TypeCheck */ |
123 | |
124 | #if TypeCheck1 |
125 | if (BAD_TYPECHECK(&In0P->sigcodeType, &sigcodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sigcodeType); _c.t = *(& sigcodeCheck);_t.w != _c.w; })), 0)) |
126 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
127 | #endif /* TypeCheck */ |
128 | |
129 | #if TypeCheck1 |
130 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
131 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
132 | #endif /* TypeCheck */ |
133 | |
134 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
135 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
136 | else |
137 | process = In0P->Head.msgh_request_portmsgh_local_port; |
138 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
139 | |
140 | refport = In0P->refport; |
141 | |
142 | OutP->RetCode = S_msg_sig_post(process, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->signal, In0P->sigcode, refport); |
143 | } |
144 | |
145 | /* Default implementation of S_msg_sig_post */ |
146 | #ifdef MIG_EOPNOTSUPP |
147 | kern_return_t __attribute__ ((weak)) |
148 | S_msg_sig_post |
149 | ( |
150 | mach_port_t process, |
151 | mach_port_t reply_port, |
152 | mach_msg_type_name_t reply_portPoly, |
153 | int signal, |
154 | natural_t sigcode, |
155 | mach_port_t refport |
156 | ) { return MIG_EOPNOTSUPP; } |
157 | #endif /* MIG_EOPNOTSUPP */ |
158 | |
159 | /* Routine msg_proc_newids */ |
160 | mig_internalstatic void _Xmsg_proc_newids |
161 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
162 | { |
163 | typedef struct { |
164 | mach_msg_header_t Head; |
165 | mach_msg_type_t taskType; |
166 | mach_port_t task; |
167 | mach_msg_type_t ppidType; |
168 | pid_t ppid; |
169 | mach_msg_type_t pgrpType; |
170 | pid_t pgrp; |
171 | mach_msg_type_t orphanedType; |
172 | int orphaned; |
173 | } Request; |
174 | |
175 | typedef struct { |
176 | mach_msg_header_t Head; |
177 | mach_msg_type_t RetCodeType; |
178 | kern_return_t RetCode; |
179 | } Reply; |
180 | |
181 | Request *In0P = (Request *) InHeadP; |
182 | Reply *OutP = (Reply *) OutHeadP; |
183 | mig_external kern_return_t S_msg_proc_newids |
184 | (mach_port_t process, mach_port_t task, pid_t ppid, pid_t pgrp, int orphaned); |
185 | |
186 | const mach_msg_type_t taskCheck = { |
187 | /* msgt_name = */ 17, |
188 | /* msgt_size = */ 32, |
189 | /* msgt_number = */ 1, |
190 | /* msgt_inline = */ TRUE((boolean_t) 1), |
191 | /* msgt_longform = */ FALSE((boolean_t) 0), |
192 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
193 | /* msgt_unused = */ 0 |
194 | }; |
195 | |
196 | const mach_msg_type_t ppidCheck = { |
197 | /* msgt_name = */ 2, |
198 | /* msgt_size = */ 32, |
199 | /* msgt_number = */ 1, |
200 | /* msgt_inline = */ TRUE((boolean_t) 1), |
201 | /* msgt_longform = */ FALSE((boolean_t) 0), |
202 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
203 | /* msgt_unused = */ 0 |
204 | }; |
205 | |
206 | const mach_msg_type_t pgrpCheck = { |
207 | /* msgt_name = */ 2, |
208 | /* msgt_size = */ 32, |
209 | /* msgt_number = */ 1, |
210 | /* msgt_inline = */ TRUE((boolean_t) 1), |
211 | /* msgt_longform = */ FALSE((boolean_t) 0), |
212 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
213 | /* msgt_unused = */ 0 |
214 | }; |
215 | |
216 | const mach_msg_type_t orphanedCheck = { |
217 | /* msgt_name = */ 2, |
218 | /* msgt_size = */ 32, |
219 | /* msgt_number = */ 1, |
220 | /* msgt_inline = */ TRUE((boolean_t) 1), |
221 | /* msgt_longform = */ FALSE((boolean_t) 0), |
222 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
223 | /* msgt_unused = */ 0 |
224 | }; |
225 | |
226 | mach_port_t process; |
227 | |
228 | #if TypeCheck1 |
229 | if (mig_unlikely ((In0P->Head.msgh_size != 56) ||__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
230 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 56) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
231 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
232 | #endif /* TypeCheck */ |
233 | |
234 | #if TypeCheck1 |
235 | if (BAD_TYPECHECK(&In0P->taskType, &taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->taskType); _c.t = *(& taskCheck);_t.w != _c.w; })), 0)) |
236 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
237 | #endif /* TypeCheck */ |
238 | |
239 | #if TypeCheck1 |
240 | if (BAD_TYPECHECK(&In0P->ppidType, &ppidCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->ppidType); _c.t = *(& ppidCheck);_t.w != _c.w; })), 0)) |
241 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
242 | #endif /* TypeCheck */ |
243 | |
244 | #if TypeCheck1 |
245 | if (BAD_TYPECHECK(&In0P->pgrpType, &pgrpCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->pgrpType); _c.t = *(& pgrpCheck);_t.w != _c.w; })), 0)) |
246 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
247 | #endif /* TypeCheck */ |
248 | |
249 | #if TypeCheck1 |
250 | if (BAD_TYPECHECK(&In0P->orphanedType, &orphanedCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->orphanedType); _c.t = *( &orphanedCheck);_t.w != _c.w; })), 0)) |
251 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
252 | #endif /* TypeCheck */ |
253 | |
254 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
255 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
256 | else |
257 | process = In0P->Head.msgh_request_portmsgh_local_port; |
258 | OutP->RetCode = S_msg_proc_newids(process, In0P->task, In0P->ppid, In0P->pgrp, In0P->orphaned); |
259 | } |
260 | |
261 | /* Default implementation of S_msg_proc_newids */ |
262 | #ifdef MIG_EOPNOTSUPP |
263 | kern_return_t __attribute__ ((weak)) |
264 | S_msg_proc_newids |
265 | ( |
266 | mach_port_t process, |
267 | mach_port_t task, |
268 | pid_t ppid, |
269 | pid_t pgrp, |
270 | int orphaned |
271 | ) { return MIG_EOPNOTSUPP; } |
272 | #endif /* MIG_EOPNOTSUPP */ |
273 | |
274 | /* Routine msg_add_auth */ |
275 | mig_internalstatic void _Xmsg_add_auth |
276 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
277 | { |
278 | typedef struct { |
279 | mach_msg_header_t Head; |
280 | mach_msg_type_t authType; |
281 | auth_t auth; |
282 | } Request; |
283 | |
284 | typedef struct { |
285 | mach_msg_header_t Head; |
286 | mach_msg_type_t RetCodeType; |
287 | kern_return_t RetCode; |
288 | } Reply; |
289 | |
290 | Request *In0P = (Request *) InHeadP; |
291 | Reply *OutP = (Reply *) OutHeadP; |
292 | mig_external kern_return_t S_msg_add_auth |
293 | (mach_port_t process, auth_t auth); |
294 | |
295 | const mach_msg_type_t authCheck = { |
296 | /* msgt_name = */ 17, |
297 | /* msgt_size = */ 32, |
298 | /* msgt_number = */ 1, |
299 | /* msgt_inline = */ TRUE((boolean_t) 1), |
300 | /* msgt_longform = */ FALSE((boolean_t) 0), |
301 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
302 | /* msgt_unused = */ 0 |
303 | }; |
304 | |
305 | mach_port_t process; |
306 | auth_t auth; |
307 | |
308 | #if TypeCheck1 |
309 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
310 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
311 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
312 | #endif /* TypeCheck */ |
313 | |
314 | #if TypeCheck1 |
315 | if (BAD_TYPECHECK(&In0P->authType, &authCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->authType); _c.t = *(& authCheck);_t.w != _c.w; })), 0)) |
316 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
317 | #endif /* TypeCheck */ |
318 | |
319 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
320 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
321 | else |
322 | process = In0P->Head.msgh_request_portmsgh_local_port; |
323 | auth = In0P->auth; |
324 | |
325 | OutP->RetCode = S_msg_add_auth(process, auth); |
326 | } |
327 | |
328 | /* Default implementation of S_msg_add_auth */ |
329 | #ifdef MIG_EOPNOTSUPP |
330 | kern_return_t __attribute__ ((weak)) |
331 | S_msg_add_auth |
332 | ( |
333 | mach_port_t process, |
334 | auth_t auth |
335 | ) { return MIG_EOPNOTSUPP; } |
336 | #endif /* MIG_EOPNOTSUPP */ |
337 | |
338 | /* Routine msg_del_auth */ |
339 | mig_internalstatic void _Xmsg_del_auth |
340 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
341 | { |
342 | typedef struct { |
343 | mach_msg_header_t Head; |
344 | mach_msg_type_t taskType; |
345 | mach_port_t task; |
346 | mach_msg_type_long_t uidsType; |
347 | int uids[512]; |
348 | mach_msg_type_long_t gidsType; |
349 | int gids[512]; |
350 | } Request; |
351 | |
352 | typedef struct { |
353 | mach_msg_header_t Head; |
354 | mach_msg_type_t RetCodeType; |
355 | kern_return_t RetCode; |
356 | } Reply; |
357 | |
358 | Request *In0P = (Request *) InHeadP; |
359 | Request *In1P; |
360 | Reply *OutP = (Reply *) OutHeadP; |
361 | mig_external kern_return_t S_msg_del_auth |
362 | (mach_port_t process, mach_port_t task, intarray_t uids, mach_msg_type_number_t uidsCnt, intarray_t gids, mach_msg_type_number_t gidsCnt); |
363 | |
364 | unsigned int msgh_size; |
365 | unsigned int msgh_size_delta; |
366 | |
367 | const mach_msg_type_t taskCheck = { |
368 | /* msgt_name = */ 17, |
369 | /* msgt_size = */ 32, |
370 | /* msgt_number = */ 1, |
371 | /* msgt_inline = */ TRUE((boolean_t) 1), |
372 | /* msgt_longform = */ FALSE((boolean_t) 0), |
373 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
374 | /* msgt_unused = */ 0 |
375 | }; |
376 | |
377 | mach_port_t process; |
378 | |
379 | #if TypeCheck1 |
380 | msgh_size = In0P->Head.msgh_size; |
381 | if (mig_unlikely ((msgh_size < 56) ||__builtin_expect (!! ((msgh_size < 56) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
382 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 56) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
383 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
384 | #endif /* TypeCheck */ |
385 | |
386 | #if TypeCheck1 |
387 | if (BAD_TYPECHECK(&In0P->taskType, &taskCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->taskType); _c.t = *(& taskCheck);_t.w != _c.w; })), 0)) |
388 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
389 | #endif /* TypeCheck */ |
390 | |
391 | #if TypeCheck1 |
392 | if (mig_unlikely ((In0P->uidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->uidsType.msgtl_name != 2) || (In0P->uidsType.msgtl_size != 32)), 0) |
393 | (In0P->uidsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->uidsType.msgtl_name != 2) || (In0P->uidsType.msgtl_size != 32)), 0) |
394 | (In0P->uidsType.msgtl_size != 32))__builtin_expect (!! ((In0P->uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->uidsType.msgtl_name != 2) || (In0P->uidsType.msgtl_size != 32)), 0)) |
395 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
396 | #endif /* TypeCheck */ |
397 | |
398 | msgh_size_delta = (In0P->uidsType.msgtl_header.msgt_inline) ? 4 * In0P->uidsType.msgtl_number : sizeof(int *); |
399 | #if TypeCheck1 |
400 | if (mig_unlikely (msgh_size < 56 + msgh_size_delta)__builtin_expect (!! (msgh_size < 56 + msgh_size_delta), 0 )) |
401 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
402 | msgh_size -= msgh_size_delta; |
403 | #endif /* TypeCheck */ |
404 | |
405 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
406 | |
407 | #if TypeCheck1 |
408 | if (mig_unlikely ((In1P->gidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gidsType.msgtl_name != 2) || (In1P->gidsType.msgtl_size != 32)), 0) |
409 | (In1P->gidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gidsType.msgtl_name != 2) || (In1P->gidsType.msgtl_size != 32)), 0) |
410 | (In1P->gidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gidsType.msgtl_name != 2) || (In1P->gidsType.msgtl_size != 32)), 0)) |
411 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
412 | #endif /* TypeCheck */ |
413 | |
414 | #if TypeCheck1 |
415 | if (mig_unlikely (msgh_size != 56 + ((In1P->gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gidsType.msgtl_number : sizeof(int *)))__builtin_expect (!! (msgh_size != 56 + ((In1P->gidsType.msgtl_header .msgt_inline) ? 4 * In1P->gidsType.msgtl_number : sizeof(int *))), 0)) |
416 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
417 | #endif /* TypeCheck */ |
418 | |
419 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
420 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
421 | else |
422 | process = In0P->Head.msgh_request_portmsgh_local_port; |
423 | OutP->RetCode = S_msg_del_auth(process, In0P->task, (In0P->uidsType.msgtl_header.msgt_inline) ? In0P->uids : *((int **)In0P->uids), In0P->uidsType.msgtl_number, (In1P->gidsType.msgtl_header.msgt_inline) ? In1P->gids : *((int **)In1P->gids), In1P->gidsType.msgtl_number); |
424 | if (OutP->RetCode == KERN_SUCCESS0) |
425 | if (!In1P->gidsType.msgtl_header.msgt_inline) |
426 | __mig_deallocate(* (vm_offset_t *) In1P->gids, 4 * In1P->gidsType.msgtl_number); |
427 | if (OutP->RetCode == KERN_SUCCESS0) |
428 | if (!In0P->uidsType.msgtl_header.msgt_inline) |
429 | __mig_deallocate(* (vm_offset_t *) In0P->uids, 4 * In0P->uidsType.msgtl_number); |
430 | } |
431 | |
432 | /* Default implementation of S_msg_del_auth */ |
433 | #ifdef MIG_EOPNOTSUPP |
434 | kern_return_t __attribute__ ((weak)) |
435 | S_msg_del_auth |
436 | ( |
437 | mach_port_t process, |
438 | mach_port_t task, |
439 | intarray_t uids, |
440 | mach_msg_type_number_t uidsCnt, |
441 | intarray_t gids, |
442 | mach_msg_type_number_t gidsCnt |
443 | ) { return MIG_EOPNOTSUPP; } |
444 | #endif /* MIG_EOPNOTSUPP */ |
445 | |
446 | /* Routine msg_get_init_port */ |
447 | mig_internalstatic void _Xmsg_get_init_port |
448 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
449 | { |
450 | typedef struct { |
451 | mach_msg_header_t Head; |
452 | mach_msg_type_t refportType; |
453 | mach_port_t refport; |
454 | mach_msg_type_t whichType; |
455 | int which; |
456 | } Request; |
457 | |
458 | typedef struct { |
459 | mach_msg_header_t Head; |
460 | mach_msg_type_t RetCodeType; |
461 | kern_return_t RetCode; |
462 | mach_msg_type_t portType; |
463 | mach_port_t port; |
464 | } Reply; |
465 | |
466 | Request *In0P = (Request *) InHeadP; |
467 | Reply *OutP = (Reply *) OutHeadP; |
468 | mig_external kern_return_t S_msg_get_init_port |
469 | (mach_port_t process, mach_port_t refport, int which, mach_port_t *port, mach_msg_type_name_t *portPoly); |
470 | |
471 | boolean_t msgh_simple = msgh_simple; |
472 | const mach_msg_type_t refportCheck = { |
473 | /* msgt_name = */ 17, |
474 | /* msgt_size = */ 32, |
475 | /* msgt_number = */ 1, |
476 | /* msgt_inline = */ TRUE((boolean_t) 1), |
477 | /* msgt_longform = */ FALSE((boolean_t) 0), |
478 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
479 | /* msgt_unused = */ 0 |
480 | }; |
481 | |
482 | const mach_msg_type_t whichCheck = { |
483 | /* msgt_name = */ 2, |
484 | /* msgt_size = */ 32, |
485 | /* msgt_number = */ 1, |
486 | /* msgt_inline = */ TRUE((boolean_t) 1), |
487 | /* msgt_longform = */ FALSE((boolean_t) 0), |
488 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
489 | /* msgt_unused = */ 0 |
490 | }; |
491 | |
492 | const mach_msg_type_t portType = { |
493 | /* msgt_name = */ -1, |
494 | /* msgt_size = */ 32, |
495 | /* msgt_number = */ 1, |
496 | /* msgt_inline = */ TRUE((boolean_t) 1), |
497 | /* msgt_longform = */ FALSE((boolean_t) 0), |
498 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
499 | /* msgt_unused = */ 0 |
500 | }; |
501 | |
502 | mach_port_t process; |
503 | mach_port_t refport; |
504 | mach_msg_type_name_t portPoly; |
505 | |
506 | #if TypeCheck1 |
507 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
508 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
509 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
510 | #endif /* TypeCheck */ |
511 | |
512 | #if TypeCheck1 |
513 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
514 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
515 | #endif /* TypeCheck */ |
516 | |
517 | #if TypeCheck1 |
518 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
519 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
520 | #endif /* TypeCheck */ |
521 | |
522 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
523 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
524 | else |
525 | process = In0P->Head.msgh_request_portmsgh_local_port; |
526 | refport = In0P->refport; |
527 | |
528 | OutP->RetCode = S_msg_get_init_port(process, refport, In0P->which, &OutP->port, &portPoly); |
529 | if (OutP->RetCode != KERN_SUCCESS0) |
530 | return; |
531 | |
532 | msgh_simple = TRUE((boolean_t) 1); |
533 | OutP->Head.msgh_size = 40; |
534 | |
535 | OutP->portType = portType; |
536 | |
537 | if (MACH_MSG_TYPE_PORT_ANY(portPoly)(((portPoly) >= 16) && ((portPoly) <= 21))) |
538 | msgh_simple = FALSE((boolean_t) 0); |
539 | |
540 | OutP->portType.msgt_name = portPoly; |
541 | |
542 | if (!msgh_simple) |
543 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
544 | } |
545 | |
546 | /* Default implementation of S_msg_get_init_port */ |
547 | #ifdef MIG_EOPNOTSUPP |
548 | kern_return_t __attribute__ ((weak)) |
549 | S_msg_get_init_port |
550 | ( |
551 | mach_port_t process, |
552 | mach_port_t refport, |
553 | int which, |
554 | mach_port_t *port, |
555 | mach_msg_type_name_t *portPoly |
556 | ) { return MIG_EOPNOTSUPP; } |
557 | #endif /* MIG_EOPNOTSUPP */ |
558 | |
559 | /* Routine msg_set_init_port */ |
560 | mig_internalstatic void _Xmsg_set_init_port |
561 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
562 | { |
563 | typedef struct { |
564 | mach_msg_header_t Head; |
565 | mach_msg_type_t refportType; |
566 | mach_port_t refport; |
567 | mach_msg_type_t whichType; |
568 | int which; |
569 | mach_msg_type_t portType; |
570 | mach_port_t port; |
571 | } Request; |
572 | |
573 | typedef struct { |
574 | mach_msg_header_t Head; |
575 | mach_msg_type_t RetCodeType; |
576 | kern_return_t RetCode; |
577 | } Reply; |
578 | |
579 | Request *In0P = (Request *) InHeadP; |
580 | Reply *OutP = (Reply *) OutHeadP; |
581 | mig_external kern_return_t S_msg_set_init_port |
582 | (mach_port_t process, mach_port_t refport, int which, mach_port_t port); |
583 | |
584 | const mach_msg_type_t refportCheck = { |
585 | /* msgt_name = */ 17, |
586 | /* msgt_size = */ 32, |
587 | /* msgt_number = */ 1, |
588 | /* msgt_inline = */ TRUE((boolean_t) 1), |
589 | /* msgt_longform = */ FALSE((boolean_t) 0), |
590 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
591 | /* msgt_unused = */ 0 |
592 | }; |
593 | |
594 | const mach_msg_type_t whichCheck = { |
595 | /* msgt_name = */ 2, |
596 | /* msgt_size = */ 32, |
597 | /* msgt_number = */ 1, |
598 | /* msgt_inline = */ TRUE((boolean_t) 1), |
599 | /* msgt_longform = */ FALSE((boolean_t) 0), |
600 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
601 | /* msgt_unused = */ 0 |
602 | }; |
603 | |
604 | const mach_msg_type_t portCheck = { |
605 | /* msgt_name = */ 17, |
606 | /* msgt_size = */ 32, |
607 | /* msgt_number = */ 1, |
608 | /* msgt_inline = */ TRUE((boolean_t) 1), |
609 | /* msgt_longform = */ FALSE((boolean_t) 0), |
610 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
611 | /* msgt_unused = */ 0 |
612 | }; |
613 | |
614 | mach_port_t process; |
615 | mach_port_t refport; |
616 | |
617 | #if TypeCheck1 |
618 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
619 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
620 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
621 | #endif /* TypeCheck */ |
622 | |
623 | #if TypeCheck1 |
624 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
625 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
626 | #endif /* TypeCheck */ |
627 | |
628 | #if TypeCheck1 |
629 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
630 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
631 | #endif /* TypeCheck */ |
632 | |
633 | #if TypeCheck1 |
634 | if (BAD_TYPECHECK(&In0P->portType, &portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->portType); _c.t = *(& portCheck);_t.w != _c.w; })), 0)) |
635 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
636 | #endif /* TypeCheck */ |
637 | |
638 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
639 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
640 | else |
641 | process = In0P->Head.msgh_request_portmsgh_local_port; |
642 | refport = In0P->refport; |
643 | |
644 | OutP->RetCode = S_msg_set_init_port(process, refport, In0P->which, In0P->port); |
645 | } |
646 | |
647 | /* Default implementation of S_msg_set_init_port */ |
648 | #ifdef MIG_EOPNOTSUPP |
649 | kern_return_t __attribute__ ((weak)) |
650 | S_msg_set_init_port |
651 | ( |
652 | mach_port_t process, |
653 | mach_port_t refport, |
654 | int which, |
655 | mach_port_t port |
656 | ) { return MIG_EOPNOTSUPP; } |
657 | #endif /* MIG_EOPNOTSUPP */ |
658 | |
659 | /* Routine msg_get_init_ports */ |
660 | mig_internalstatic void _Xmsg_get_init_ports |
661 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
662 | { |
663 | typedef struct { |
664 | mach_msg_header_t Head; |
665 | mach_msg_type_t refportType; |
666 | mach_port_t refport; |
667 | } Request; |
668 | |
669 | typedef struct { |
670 | mach_msg_header_t Head; |
671 | mach_msg_type_t RetCodeType; |
672 | kern_return_t RetCode; |
673 | mach_msg_type_long_t portsType; |
674 | mach_port_t ports[512]; |
675 | } Reply; |
676 | |
677 | Request *In0P = (Request *) InHeadP; |
678 | Reply *OutP = (Reply *) OutHeadP; |
679 | mig_external kern_return_t S_msg_get_init_ports |
680 | (mach_port_t process, mach_port_t refport, portarray_t *ports, mach_msg_type_name_t *portsPoly, mach_msg_type_number_t *portsCnt); |
681 | |
682 | boolean_t msgh_simple = msgh_simple; |
683 | const mach_msg_type_t refportCheck = { |
684 | /* msgt_name = */ 17, |
685 | /* msgt_size = */ 32, |
686 | /* msgt_number = */ 1, |
687 | /* msgt_inline = */ TRUE((boolean_t) 1), |
688 | /* msgt_longform = */ FALSE((boolean_t) 0), |
689 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
690 | /* msgt_unused = */ 0 |
691 | }; |
692 | |
693 | const mach_msg_type_long_t portsType = { |
694 | { |
695 | /* msgt_name = */ 0, |
696 | /* msgt_size = */ 0, |
697 | /* msgt_number = */ 0, |
698 | /* msgt_inline = */ TRUE((boolean_t) 1), |
699 | /* msgt_longform = */ TRUE((boolean_t) 1), |
700 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
701 | /* msgt_unused = */ 0 |
702 | }, |
703 | /* msgtl_name = */ -1, |
704 | /* msgtl_size = */ 32, |
705 | /* msgtl_number = */ 512, |
706 | }; |
707 | |
708 | mach_port_t process; |
709 | mach_port_t refport; |
710 | mach_msg_type_name_t portsPoly; |
711 | mach_msg_type_number_t portsCnt; |
712 | |
713 | mach_port_t *portsP; |
714 | |
715 | #if TypeCheck1 |
716 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
717 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
718 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
719 | #endif /* TypeCheck */ |
720 | |
721 | #if TypeCheck1 |
722 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
723 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
724 | #endif /* TypeCheck */ |
725 | |
726 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
727 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
728 | else |
729 | process = In0P->Head.msgh_request_portmsgh_local_port; |
730 | refport = In0P->refport; |
731 | |
732 | portsP = OutP->ports; |
733 | portsCnt = 512; |
734 | |
735 | OutP->RetCode = S_msg_get_init_ports(process, refport, &portsP, &portsPoly, &portsCnt); |
736 | if (OutP->RetCode != KERN_SUCCESS0) |
737 | return; |
738 | |
739 | msgh_simple = TRUE((boolean_t) 1); |
740 | |
741 | OutP->portsType = portsType; |
742 | if (portsP != OutP->ports) { |
743 | OutP->portsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
744 | OutP->portsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
745 | *((mach_port_t **)OutP->ports) = portsP; |
746 | msgh_simple = FALSE((boolean_t) 0); |
747 | } |
748 | |
749 | if (MACH_MSG_TYPE_PORT_ANY(portsPoly)(((portsPoly) >= 16) && ((portsPoly) <= 21))) |
750 | msgh_simple = FALSE((boolean_t) 0); |
751 | |
752 | OutP->portsType.msgtl_name = portsPoly; |
753 | |
754 | OutP->portsType.msgtl_number = portsCnt; |
755 | OutP->Head.msgh_size = 44 + ((OutP->portsType.msgtl_header.msgt_inline) ? 4 * portsCnt : sizeof(mach_port_t *)); |
756 | |
757 | if (!msgh_simple) |
758 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
759 | } |
760 | |
761 | /* Default implementation of S_msg_get_init_ports */ |
762 | #ifdef MIG_EOPNOTSUPP |
763 | kern_return_t __attribute__ ((weak)) |
764 | S_msg_get_init_ports |
765 | ( |
766 | mach_port_t process, |
767 | mach_port_t refport, |
768 | portarray_t *ports, |
769 | mach_msg_type_name_t *portsPoly, |
770 | mach_msg_type_number_t *portsCnt |
771 | ) { return MIG_EOPNOTSUPP; } |
772 | #endif /* MIG_EOPNOTSUPP */ |
773 | |
774 | /* Routine msg_set_init_ports */ |
775 | mig_internalstatic void _Xmsg_set_init_ports |
776 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
777 | { |
778 | typedef struct { |
779 | mach_msg_header_t Head; |
780 | mach_msg_type_t refportType; |
781 | mach_port_t refport; |
782 | mach_msg_type_long_t portsType; |
783 | mach_port_t ports[512]; |
784 | } Request; |
785 | |
786 | typedef struct { |
787 | mach_msg_header_t Head; |
788 | mach_msg_type_t RetCodeType; |
789 | kern_return_t RetCode; |
790 | } Reply; |
791 | |
792 | Request *In0P = (Request *) InHeadP; |
793 | Reply *OutP = (Reply *) OutHeadP; |
794 | mig_external kern_return_t S_msg_set_init_ports |
795 | (mach_port_t process, mach_port_t refport, portarray_t ports, mach_msg_type_number_t portsCnt); |
796 | |
797 | unsigned int msgh_size; |
798 | |
799 | const mach_msg_type_t refportCheck = { |
800 | /* msgt_name = */ 17, |
801 | /* msgt_size = */ 32, |
802 | /* msgt_number = */ 1, |
803 | /* msgt_inline = */ TRUE((boolean_t) 1), |
804 | /* msgt_longform = */ FALSE((boolean_t) 0), |
805 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
806 | /* msgt_unused = */ 0 |
807 | }; |
808 | |
809 | mach_port_t process; |
810 | mach_port_t refport; |
811 | |
812 | #if TypeCheck1 |
813 | msgh_size = In0P->Head.msgh_size; |
814 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
815 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
816 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
817 | #endif /* TypeCheck */ |
818 | |
819 | #if TypeCheck1 |
820 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
821 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
822 | #endif /* TypeCheck */ |
823 | |
824 | #if TypeCheck1 |
825 | if (mig_unlikely ((In0P->portsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0) |
826 | (In0P->portsType.msgtl_name != 17) ||__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0) |
827 | (In0P->portsType.msgtl_size != 32))__builtin_expect (!! ((In0P->portsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->portsType.msgtl_name != 17) || (In0P->portsType.msgtl_size != 32)), 0)) |
828 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
829 | #endif /* TypeCheck */ |
830 | |
831 | #if TypeCheck1 |
832 | if (mig_unlikely (msgh_size != 44 + ((In0P->portsType.msgtl_header.msgt_inline) ? 4 * In0P->portsType.msgtl_number : sizeof(mach_port_t *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->portsType. msgtl_header.msgt_inline) ? 4 * In0P->portsType.msgtl_number : sizeof(mach_port_t *))), 0)) |
833 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
834 | #endif /* TypeCheck */ |
835 | |
836 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
837 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
838 | else |
839 | process = In0P->Head.msgh_request_portmsgh_local_port; |
840 | refport = In0P->refport; |
841 | |
842 | OutP->RetCode = S_msg_set_init_ports(process, refport, (In0P->portsType.msgtl_header.msgt_inline) ? In0P->ports : *((mach_port_t **)In0P->ports), In0P->portsType.msgtl_number); |
843 | if (OutP->RetCode == KERN_SUCCESS0) |
844 | if (!In0P->portsType.msgtl_header.msgt_inline) |
845 | __mig_deallocate(* (vm_offset_t *) In0P->ports, 4 * In0P->portsType.msgtl_number); |
846 | } |
847 | |
848 | /* Default implementation of S_msg_set_init_ports */ |
849 | #ifdef MIG_EOPNOTSUPP |
850 | kern_return_t __attribute__ ((weak)) |
851 | S_msg_set_init_ports |
852 | ( |
853 | mach_port_t process, |
854 | mach_port_t refport, |
855 | portarray_t ports, |
856 | mach_msg_type_number_t portsCnt |
857 | ) { return MIG_EOPNOTSUPP; } |
858 | #endif /* MIG_EOPNOTSUPP */ |
859 | |
860 | /* Routine msg_get_init_int */ |
861 | mig_internalstatic void _Xmsg_get_init_int |
862 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
863 | { |
864 | typedef struct { |
865 | mach_msg_header_t Head; |
866 | mach_msg_type_t refportType; |
867 | mach_port_t refport; |
868 | mach_msg_type_t whichType; |
869 | int which; |
870 | } Request; |
871 | |
872 | typedef struct { |
873 | mach_msg_header_t Head; |
874 | mach_msg_type_t RetCodeType; |
875 | kern_return_t RetCode; |
876 | mach_msg_type_t valueType; |
877 | int value; |
878 | } Reply; |
879 | |
880 | Request *In0P = (Request *) InHeadP; |
881 | Reply *OutP = (Reply *) OutHeadP; |
882 | mig_external kern_return_t S_msg_get_init_int |
883 | (mach_port_t process, mach_port_t refport, int which, int *value); |
884 | |
885 | const mach_msg_type_t refportCheck = { |
886 | /* msgt_name = */ 17, |
887 | /* msgt_size = */ 32, |
888 | /* msgt_number = */ 1, |
889 | /* msgt_inline = */ TRUE((boolean_t) 1), |
890 | /* msgt_longform = */ FALSE((boolean_t) 0), |
891 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
892 | /* msgt_unused = */ 0 |
893 | }; |
894 | |
895 | const mach_msg_type_t whichCheck = { |
896 | /* msgt_name = */ 2, |
897 | /* msgt_size = */ 32, |
898 | /* msgt_number = */ 1, |
899 | /* msgt_inline = */ TRUE((boolean_t) 1), |
900 | /* msgt_longform = */ FALSE((boolean_t) 0), |
901 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
902 | /* msgt_unused = */ 0 |
903 | }; |
904 | |
905 | const mach_msg_type_t valueType = { |
906 | /* msgt_name = */ 2, |
907 | /* msgt_size = */ 32, |
908 | /* msgt_number = */ 1, |
909 | /* msgt_inline = */ TRUE((boolean_t) 1), |
910 | /* msgt_longform = */ FALSE((boolean_t) 0), |
911 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
912 | /* msgt_unused = */ 0 |
913 | }; |
914 | |
915 | mach_port_t process; |
916 | mach_port_t refport; |
917 | |
918 | #if TypeCheck1 |
919 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
920 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
921 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
922 | #endif /* TypeCheck */ |
923 | |
924 | #if TypeCheck1 |
925 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
926 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
927 | #endif /* TypeCheck */ |
928 | |
929 | #if TypeCheck1 |
930 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
931 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
932 | #endif /* TypeCheck */ |
933 | |
934 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
935 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
936 | else |
937 | process = In0P->Head.msgh_request_portmsgh_local_port; |
938 | refport = In0P->refport; |
939 | |
940 | OutP->RetCode = S_msg_get_init_int(process, refport, In0P->which, &OutP->value); |
941 | if (OutP->RetCode != KERN_SUCCESS0) |
942 | return; |
943 | |
944 | OutP->Head.msgh_size = 40; |
945 | |
946 | OutP->valueType = valueType; |
947 | } |
948 | |
949 | /* Default implementation of S_msg_get_init_int */ |
950 | #ifdef MIG_EOPNOTSUPP |
951 | kern_return_t __attribute__ ((weak)) |
952 | S_msg_get_init_int |
953 | ( |
954 | mach_port_t process, |
955 | mach_port_t refport, |
956 | int which, |
957 | int *value |
958 | ) { return MIG_EOPNOTSUPP; } |
959 | #endif /* MIG_EOPNOTSUPP */ |
960 | |
961 | /* Routine msg_set_init_int */ |
962 | mig_internalstatic void _Xmsg_set_init_int |
963 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
964 | { |
965 | typedef struct { |
966 | mach_msg_header_t Head; |
967 | mach_msg_type_t refportType; |
968 | mach_port_t refport; |
969 | mach_msg_type_t whichType; |
970 | int which; |
971 | mach_msg_type_t valueType; |
972 | int value; |
973 | } Request; |
974 | |
975 | typedef struct { |
976 | mach_msg_header_t Head; |
977 | mach_msg_type_t RetCodeType; |
978 | kern_return_t RetCode; |
979 | } Reply; |
980 | |
981 | Request *In0P = (Request *) InHeadP; |
982 | Reply *OutP = (Reply *) OutHeadP; |
983 | mig_external kern_return_t S_msg_set_init_int |
984 | (mach_port_t process, mach_port_t refport, int which, int value); |
985 | |
986 | const mach_msg_type_t refportCheck = { |
987 | /* msgt_name = */ 17, |
988 | /* msgt_size = */ 32, |
989 | /* msgt_number = */ 1, |
990 | /* msgt_inline = */ TRUE((boolean_t) 1), |
991 | /* msgt_longform = */ FALSE((boolean_t) 0), |
992 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
993 | /* msgt_unused = */ 0 |
994 | }; |
995 | |
996 | const mach_msg_type_t whichCheck = { |
997 | /* msgt_name = */ 2, |
998 | /* msgt_size = */ 32, |
999 | /* msgt_number = */ 1, |
1000 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1001 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1002 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1003 | /* msgt_unused = */ 0 |
1004 | }; |
1005 | |
1006 | const mach_msg_type_t valueCheck = { |
1007 | /* msgt_name = */ 2, |
1008 | /* msgt_size = */ 32, |
1009 | /* msgt_number = */ 1, |
1010 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1011 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1012 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1013 | /* msgt_unused = */ 0 |
1014 | }; |
1015 | |
1016 | mach_port_t process; |
1017 | mach_port_t refport; |
1018 | |
1019 | #if TypeCheck1 |
1020 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1021 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1022 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1023 | #endif /* TypeCheck */ |
1024 | |
1025 | #if TypeCheck1 |
1026 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1027 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1028 | #endif /* TypeCheck */ |
1029 | |
1030 | #if TypeCheck1 |
1031 | if (BAD_TYPECHECK(&In0P->whichType, &whichCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->whichType); _c.t = *(& whichCheck);_t.w != _c.w; })), 0)) |
1032 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1033 | #endif /* TypeCheck */ |
1034 | |
1035 | #if TypeCheck1 |
1036 | if (BAD_TYPECHECK(&In0P->valueType, &valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->valueType); _c.t = *(& valueCheck);_t.w != _c.w; })), 0)) |
1037 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1038 | #endif /* TypeCheck */ |
1039 | |
1040 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1041 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1042 | else |
1043 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1044 | refport = In0P->refport; |
1045 | |
1046 | OutP->RetCode = S_msg_set_init_int(process, refport, In0P->which, In0P->value); |
1047 | } |
1048 | |
1049 | /* Default implementation of S_msg_set_init_int */ |
1050 | #ifdef MIG_EOPNOTSUPP |
1051 | kern_return_t __attribute__ ((weak)) |
1052 | S_msg_set_init_int |
1053 | ( |
1054 | mach_port_t process, |
1055 | mach_port_t refport, |
1056 | int which, |
1057 | int value |
1058 | ) { return MIG_EOPNOTSUPP; } |
1059 | #endif /* MIG_EOPNOTSUPP */ |
1060 | |
1061 | /* Routine msg_get_init_ints */ |
1062 | mig_internalstatic void _Xmsg_get_init_ints |
1063 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1064 | { |
1065 | typedef struct { |
1066 | mach_msg_header_t Head; |
1067 | mach_msg_type_t refportType; |
1068 | mach_port_t refport; |
1069 | } Request; |
1070 | |
1071 | typedef struct { |
1072 | mach_msg_header_t Head; |
1073 | mach_msg_type_t RetCodeType; |
1074 | kern_return_t RetCode; |
1075 | mach_msg_type_long_t valuesType; |
1076 | int values[512]; |
1077 | } Reply; |
1078 | |
1079 | Request *In0P = (Request *) InHeadP; |
1080 | Reply *OutP = (Reply *) OutHeadP; |
1081 | mig_external kern_return_t S_msg_get_init_ints |
1082 | (mach_port_t process, mach_port_t refport, intarray_t *values, mach_msg_type_number_t *valuesCnt); |
1083 | |
1084 | boolean_t msgh_simple = msgh_simple; |
1085 | const mach_msg_type_t refportCheck = { |
1086 | /* msgt_name = */ 17, |
1087 | /* msgt_size = */ 32, |
1088 | /* msgt_number = */ 1, |
1089 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1090 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1091 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1092 | /* msgt_unused = */ 0 |
1093 | }; |
1094 | |
1095 | const mach_msg_type_long_t valuesType = { |
1096 | { |
1097 | /* msgt_name = */ 0, |
1098 | /* msgt_size = */ 0, |
1099 | /* msgt_number = */ 0, |
1100 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1101 | /* msgt_longform = */ TRUE((boolean_t) 1), |
1102 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1103 | /* msgt_unused = */ 0 |
1104 | }, |
1105 | /* msgtl_name = */ 2, |
1106 | /* msgtl_size = */ 32, |
1107 | /* msgtl_number = */ 512, |
1108 | }; |
1109 | |
1110 | mach_port_t process; |
1111 | mach_port_t refport; |
1112 | mach_msg_type_number_t valuesCnt; |
1113 | |
1114 | int *valuesP; |
1115 | |
1116 | #if TypeCheck1 |
1117 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1118 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1119 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1120 | #endif /* TypeCheck */ |
1121 | |
1122 | #if TypeCheck1 |
1123 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1124 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1125 | #endif /* TypeCheck */ |
1126 | |
1127 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1128 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1129 | else |
1130 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1131 | refport = In0P->refport; |
1132 | |
1133 | valuesP = OutP->values; |
1134 | valuesCnt = 512; |
1135 | |
1136 | OutP->RetCode = S_msg_get_init_ints(process, refport, &valuesP, &valuesCnt); |
1137 | if (OutP->RetCode != KERN_SUCCESS0) |
1138 | return; |
1139 | |
1140 | msgh_simple = TRUE((boolean_t) 1); |
1141 | |
1142 | OutP->valuesType = valuesType; |
1143 | if (valuesP != OutP->values) { |
1144 | OutP->valuesType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1145 | OutP->valuesType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1146 | *((int **)OutP->values) = valuesP; |
1147 | msgh_simple = FALSE((boolean_t) 0); |
1148 | } |
1149 | |
1150 | OutP->valuesType.msgtl_number = valuesCnt; |
1151 | OutP->Head.msgh_size = 44 + ((OutP->valuesType.msgtl_header.msgt_inline) ? 4 * valuesCnt : sizeof(int *)); |
1152 | |
1153 | if (!msgh_simple) |
1154 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1155 | } |
1156 | |
1157 | /* Default implementation of S_msg_get_init_ints */ |
1158 | #ifdef MIG_EOPNOTSUPP |
1159 | kern_return_t __attribute__ ((weak)) |
1160 | S_msg_get_init_ints |
1161 | ( |
1162 | mach_port_t process, |
1163 | mach_port_t refport, |
1164 | intarray_t *values, |
1165 | mach_msg_type_number_t *valuesCnt |
1166 | ) { return MIG_EOPNOTSUPP; } |
1167 | #endif /* MIG_EOPNOTSUPP */ |
1168 | |
1169 | /* Routine msg_set_init_ints */ |
1170 | mig_internalstatic void _Xmsg_set_init_ints |
1171 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1172 | { |
1173 | typedef struct { |
1174 | mach_msg_header_t Head; |
1175 | mach_msg_type_t refportType; |
1176 | mach_port_t refport; |
1177 | mach_msg_type_long_t valuesType; |
1178 | int values[512]; |
1179 | } Request; |
1180 | |
1181 | typedef struct { |
1182 | mach_msg_header_t Head; |
1183 | mach_msg_type_t RetCodeType; |
1184 | kern_return_t RetCode; |
1185 | } Reply; |
1186 | |
1187 | Request *In0P = (Request *) InHeadP; |
1188 | Reply *OutP = (Reply *) OutHeadP; |
1189 | mig_external kern_return_t S_msg_set_init_ints |
1190 | (mach_port_t process, mach_port_t refport, intarray_t values, mach_msg_type_number_t valuesCnt); |
1191 | |
1192 | unsigned int msgh_size; |
1193 | |
1194 | const mach_msg_type_t refportCheck = { |
1195 | /* msgt_name = */ 17, |
1196 | /* msgt_size = */ 32, |
1197 | /* msgt_number = */ 1, |
1198 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1199 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1200 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1201 | /* msgt_unused = */ 0 |
1202 | }; |
1203 | |
1204 | mach_port_t process; |
1205 | mach_port_t refport; |
1206 | |
1207 | #if TypeCheck1 |
1208 | msgh_size = In0P->Head.msgh_size; |
1209 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
1210 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
1211 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1212 | #endif /* TypeCheck */ |
1213 | |
1214 | #if TypeCheck1 |
1215 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1216 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1217 | #endif /* TypeCheck */ |
1218 | |
1219 | #if TypeCheck1 |
1220 | if (mig_unlikely ((In0P->valuesType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->valuesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valuesType.msgtl_name != 2) || (In0P->valuesType.msgtl_size != 32)), 0) |
1221 | (In0P->valuesType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->valuesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valuesType.msgtl_name != 2) || (In0P->valuesType.msgtl_size != 32)), 0) |
1222 | (In0P->valuesType.msgtl_size != 32))__builtin_expect (!! ((In0P->valuesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valuesType.msgtl_name != 2) || (In0P->valuesType.msgtl_size != 32)), 0)) |
1223 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1224 | #endif /* TypeCheck */ |
1225 | |
1226 | #if TypeCheck1 |
1227 | if (mig_unlikely (msgh_size != 44 + ((In0P->valuesType.msgtl_header.msgt_inline) ? 4 * In0P->valuesType.msgtl_number : sizeof(int *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->valuesType .msgtl_header.msgt_inline) ? 4 * In0P->valuesType.msgtl_number : sizeof(int *))), 0)) |
1228 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1229 | #endif /* TypeCheck */ |
1230 | |
1231 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1232 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1233 | else |
1234 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1235 | refport = In0P->refport; |
1236 | |
1237 | OutP->RetCode = S_msg_set_init_ints(process, refport, (In0P->valuesType.msgtl_header.msgt_inline) ? In0P->values : *((int **)In0P->values), In0P->valuesType.msgtl_number); |
1238 | if (OutP->RetCode == KERN_SUCCESS0) |
1239 | if (!In0P->valuesType.msgtl_header.msgt_inline) |
1240 | __mig_deallocate(* (vm_offset_t *) In0P->values, 4 * In0P->valuesType.msgtl_number); |
1241 | } |
1242 | |
1243 | /* Default implementation of S_msg_set_init_ints */ |
1244 | #ifdef MIG_EOPNOTSUPP |
1245 | kern_return_t __attribute__ ((weak)) |
1246 | S_msg_set_init_ints |
1247 | ( |
1248 | mach_port_t process, |
1249 | mach_port_t refport, |
1250 | intarray_t values, |
1251 | mach_msg_type_number_t valuesCnt |
1252 | ) { return MIG_EOPNOTSUPP; } |
1253 | #endif /* MIG_EOPNOTSUPP */ |
1254 | |
1255 | /* Routine msg_get_dtable */ |
1256 | mig_internalstatic void _Xmsg_get_dtable |
1257 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1258 | { |
1259 | typedef struct { |
1260 | mach_msg_header_t Head; |
1261 | mach_msg_type_t refportType; |
1262 | mach_port_t refport; |
1263 | } Request; |
1264 | |
1265 | typedef struct { |
1266 | mach_msg_header_t Head; |
1267 | mach_msg_type_t RetCodeType; |
1268 | kern_return_t RetCode; |
1269 | mach_msg_type_long_t dtableType; |
1270 | mach_port_t dtable[512]; |
1271 | } Reply; |
1272 | |
1273 | Request *In0P = (Request *) InHeadP; |
1274 | Reply *OutP = (Reply *) OutHeadP; |
1275 | mig_external kern_return_t S_msg_get_dtable |
1276 | (mach_port_t process, mach_port_t refport, portarray_t *dtable, mach_msg_type_name_t *dtablePoly, mach_msg_type_number_t *dtableCnt); |
1277 | |
1278 | boolean_t msgh_simple = msgh_simple; |
1279 | const mach_msg_type_t refportCheck = { |
1280 | /* msgt_name = */ 17, |
1281 | /* msgt_size = */ 32, |
1282 | /* msgt_number = */ 1, |
1283 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1284 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1285 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1286 | /* msgt_unused = */ 0 |
1287 | }; |
1288 | |
1289 | const mach_msg_type_long_t dtableType = { |
1290 | { |
1291 | /* msgt_name = */ 0, |
1292 | /* msgt_size = */ 0, |
1293 | /* msgt_number = */ 0, |
1294 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1295 | /* msgt_longform = */ TRUE((boolean_t) 1), |
1296 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1297 | /* msgt_unused = */ 0 |
1298 | }, |
1299 | /* msgtl_name = */ -1, |
1300 | /* msgtl_size = */ 32, |
1301 | /* msgtl_number = */ 512, |
1302 | }; |
1303 | |
1304 | mach_port_t process; |
1305 | mach_port_t refport; |
1306 | mach_msg_type_name_t dtablePoly; |
1307 | mach_msg_type_number_t dtableCnt; |
1308 | |
1309 | mach_port_t *dtableP; |
1310 | |
1311 | #if TypeCheck1 |
1312 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1313 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1314 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1315 | #endif /* TypeCheck */ |
1316 | |
1317 | #if TypeCheck1 |
1318 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1319 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1320 | #endif /* TypeCheck */ |
1321 | |
1322 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1323 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1324 | else |
1325 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1326 | refport = In0P->refport; |
1327 | |
1328 | dtableP = OutP->dtable; |
1329 | dtableCnt = 512; |
1330 | |
1331 | OutP->RetCode = S_msg_get_dtable(process, refport, &dtableP, &dtablePoly, &dtableCnt); |
1332 | if (OutP->RetCode != KERN_SUCCESS0) |
1333 | return; |
1334 | |
1335 | msgh_simple = TRUE((boolean_t) 1); |
1336 | |
1337 | OutP->dtableType = dtableType; |
1338 | if (dtableP != OutP->dtable) { |
1339 | OutP->dtableType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1340 | OutP->dtableType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1341 | *((mach_port_t **)OutP->dtable) = dtableP; |
1342 | msgh_simple = FALSE((boolean_t) 0); |
1343 | } |
1344 | |
1345 | if (MACH_MSG_TYPE_PORT_ANY(dtablePoly)(((dtablePoly) >= 16) && ((dtablePoly) <= 21))) |
1346 | msgh_simple = FALSE((boolean_t) 0); |
1347 | |
1348 | OutP->dtableType.msgtl_name = dtablePoly; |
1349 | |
1350 | OutP->dtableType.msgtl_number = dtableCnt; |
1351 | OutP->Head.msgh_size = 44 + ((OutP->dtableType.msgtl_header.msgt_inline) ? 4 * dtableCnt : sizeof(mach_port_t *)); |
1352 | |
1353 | if (!msgh_simple) |
1354 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1355 | } |
1356 | |
1357 | /* Default implementation of S_msg_get_dtable */ |
1358 | #ifdef MIG_EOPNOTSUPP |
1359 | kern_return_t __attribute__ ((weak)) |
1360 | S_msg_get_dtable |
1361 | ( |
1362 | mach_port_t process, |
1363 | mach_port_t refport, |
1364 | portarray_t *dtable, |
1365 | mach_msg_type_name_t *dtablePoly, |
1366 | mach_msg_type_number_t *dtableCnt |
1367 | ) { return MIG_EOPNOTSUPP; } |
1368 | #endif /* MIG_EOPNOTSUPP */ |
1369 | |
1370 | /* Routine msg_set_dtable */ |
1371 | mig_internalstatic void _Xmsg_set_dtable |
1372 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1373 | { |
1374 | typedef struct { |
1375 | mach_msg_header_t Head; |
1376 | mach_msg_type_t refportType; |
1377 | mach_port_t refport; |
1378 | mach_msg_type_long_t dtableType; |
1379 | mach_port_t dtable[512]; |
1380 | } Request; |
1381 | |
1382 | typedef struct { |
1383 | mach_msg_header_t Head; |
1384 | mach_msg_type_t RetCodeType; |
1385 | kern_return_t RetCode; |
1386 | } Reply; |
1387 | |
1388 | Request *In0P = (Request *) InHeadP; |
1389 | Reply *OutP = (Reply *) OutHeadP; |
1390 | mig_external kern_return_t S_msg_set_dtable |
1391 | (mach_port_t process, mach_port_t refport, portarray_t dtable, mach_msg_type_number_t dtableCnt); |
1392 | |
1393 | unsigned int msgh_size; |
1394 | |
1395 | const mach_msg_type_t refportCheck = { |
1396 | /* msgt_name = */ 17, |
1397 | /* msgt_size = */ 32, |
1398 | /* msgt_number = */ 1, |
1399 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1400 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1401 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1402 | /* msgt_unused = */ 0 |
1403 | }; |
1404 | |
1405 | mach_port_t process; |
1406 | mach_port_t refport; |
1407 | |
1408 | #if TypeCheck1 |
1409 | msgh_size = In0P->Head.msgh_size; |
1410 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
1411 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
1412 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1413 | #endif /* TypeCheck */ |
1414 | |
1415 | #if TypeCheck1 |
1416 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1417 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1418 | #endif /* TypeCheck */ |
1419 | |
1420 | #if TypeCheck1 |
1421 | if (mig_unlikely ((In0P->dtableType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->dtableType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->dtableType.msgtl_name != 17 ) || (In0P->dtableType.msgtl_size != 32)), 0) |
1422 | (In0P->dtableType.msgtl_name != 17) ||__builtin_expect (!! ((In0P->dtableType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->dtableType.msgtl_name != 17 ) || (In0P->dtableType.msgtl_size != 32)), 0) |
1423 | (In0P->dtableType.msgtl_size != 32))__builtin_expect (!! ((In0P->dtableType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->dtableType.msgtl_name != 17 ) || (In0P->dtableType.msgtl_size != 32)), 0)) |
1424 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1425 | #endif /* TypeCheck */ |
1426 | |
1427 | #if TypeCheck1 |
1428 | if (mig_unlikely (msgh_size != 44 + ((In0P->dtableType.msgtl_header.msgt_inline) ? 4 * In0P->dtableType.msgtl_number : sizeof(mach_port_t *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->dtableType .msgtl_header.msgt_inline) ? 4 * In0P->dtableType.msgtl_number : sizeof(mach_port_t *))), 0)) |
1429 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1430 | #endif /* TypeCheck */ |
1431 | |
1432 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1433 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1434 | else |
1435 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1436 | refport = In0P->refport; |
1437 | |
1438 | OutP->RetCode = S_msg_set_dtable(process, refport, (In0P->dtableType.msgtl_header.msgt_inline) ? In0P->dtable : *((mach_port_t **)In0P->dtable), In0P->dtableType.msgtl_number); |
1439 | if (OutP->RetCode == KERN_SUCCESS0) |
1440 | if (!In0P->dtableType.msgtl_header.msgt_inline) |
1441 | __mig_deallocate(* (vm_offset_t *) In0P->dtable, 4 * In0P->dtableType.msgtl_number); |
1442 | } |
1443 | |
1444 | /* Default implementation of S_msg_set_dtable */ |
1445 | #ifdef MIG_EOPNOTSUPP |
1446 | kern_return_t __attribute__ ((weak)) |
1447 | S_msg_set_dtable |
1448 | ( |
1449 | mach_port_t process, |
1450 | mach_port_t refport, |
1451 | portarray_t dtable, |
1452 | mach_msg_type_number_t dtableCnt |
1453 | ) { return MIG_EOPNOTSUPP; } |
1454 | #endif /* MIG_EOPNOTSUPP */ |
1455 | |
1456 | /* Routine msg_get_fd */ |
1457 | mig_internalstatic void _Xmsg_get_fd |
1458 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1459 | { |
1460 | typedef struct { |
1461 | mach_msg_header_t Head; |
1462 | mach_msg_type_t refportType; |
1463 | mach_port_t refport; |
1464 | mach_msg_type_t fdType; |
1465 | int fd; |
1466 | } Request; |
1467 | |
1468 | typedef struct { |
1469 | mach_msg_header_t Head; |
1470 | mach_msg_type_t RetCodeType; |
1471 | kern_return_t RetCode; |
1472 | mach_msg_type_t portType; |
1473 | mach_port_t port; |
1474 | } Reply; |
1475 | |
1476 | Request *In0P = (Request *) InHeadP; |
1477 | Reply *OutP = (Reply *) OutHeadP; |
1478 | mig_external kern_return_t S_msg_get_fd |
1479 | (mach_port_t process, mach_port_t refport, int fd, mach_port_t *port, mach_msg_type_name_t *portPoly); |
1480 | |
1481 | boolean_t msgh_simple = msgh_simple; |
1482 | const mach_msg_type_t refportCheck = { |
1483 | /* msgt_name = */ 17, |
1484 | /* msgt_size = */ 32, |
1485 | /* msgt_number = */ 1, |
1486 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1487 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1488 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1489 | /* msgt_unused = */ 0 |
1490 | }; |
1491 | |
1492 | const mach_msg_type_t fdCheck = { |
1493 | /* msgt_name = */ 2, |
1494 | /* msgt_size = */ 32, |
1495 | /* msgt_number = */ 1, |
1496 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1497 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1498 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1499 | /* msgt_unused = */ 0 |
1500 | }; |
1501 | |
1502 | const mach_msg_type_t portType = { |
1503 | /* msgt_name = */ -1, |
1504 | /* msgt_size = */ 32, |
1505 | /* msgt_number = */ 1, |
1506 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1507 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1508 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1509 | /* msgt_unused = */ 0 |
1510 | }; |
1511 | |
1512 | mach_port_t process; |
1513 | mach_port_t refport; |
1514 | mach_msg_type_name_t portPoly; |
1515 | |
1516 | #if TypeCheck1 |
1517 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1518 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1519 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1520 | #endif /* TypeCheck */ |
1521 | |
1522 | #if TypeCheck1 |
1523 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1524 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1525 | #endif /* TypeCheck */ |
1526 | |
1527 | #if TypeCheck1 |
1528 | if (BAD_TYPECHECK(&In0P->fdType, &fdCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->fdType); _c.t = *(&fdCheck );_t.w != _c.w; })), 0)) |
1529 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1530 | #endif /* TypeCheck */ |
1531 | |
1532 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1533 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1534 | else |
1535 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1536 | refport = In0P->refport; |
1537 | |
1538 | OutP->RetCode = S_msg_get_fd(process, refport, In0P->fd, &OutP->port, &portPoly); |
1539 | if (OutP->RetCode != KERN_SUCCESS0) |
1540 | return; |
1541 | |
1542 | msgh_simple = TRUE((boolean_t) 1); |
1543 | OutP->Head.msgh_size = 40; |
1544 | |
1545 | OutP->portType = portType; |
1546 | |
1547 | if (MACH_MSG_TYPE_PORT_ANY(portPoly)(((portPoly) >= 16) && ((portPoly) <= 21))) |
1548 | msgh_simple = FALSE((boolean_t) 0); |
1549 | |
1550 | OutP->portType.msgt_name = portPoly; |
1551 | |
1552 | if (!msgh_simple) |
1553 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1554 | } |
1555 | |
1556 | /* Default implementation of S_msg_get_fd */ |
1557 | #ifdef MIG_EOPNOTSUPP |
1558 | kern_return_t __attribute__ ((weak)) |
1559 | S_msg_get_fd |
1560 | ( |
1561 | mach_port_t process, |
1562 | mach_port_t refport, |
1563 | int fd, |
1564 | mach_port_t *port, |
1565 | mach_msg_type_name_t *portPoly |
1566 | ) { return MIG_EOPNOTSUPP; } |
1567 | #endif /* MIG_EOPNOTSUPP */ |
1568 | |
1569 | /* Routine msg_set_fd */ |
1570 | mig_internalstatic void _Xmsg_set_fd |
1571 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1572 | { |
1573 | typedef struct { |
1574 | mach_msg_header_t Head; |
1575 | mach_msg_type_t refportType; |
1576 | mach_port_t refport; |
1577 | mach_msg_type_t fdType; |
1578 | int fd; |
1579 | mach_msg_type_t portType; |
1580 | mach_port_t port; |
1581 | } Request; |
1582 | |
1583 | typedef struct { |
1584 | mach_msg_header_t Head; |
1585 | mach_msg_type_t RetCodeType; |
1586 | kern_return_t RetCode; |
1587 | } Reply; |
1588 | |
1589 | Request *In0P = (Request *) InHeadP; |
1590 | Reply *OutP = (Reply *) OutHeadP; |
1591 | mig_external kern_return_t S_msg_set_fd |
1592 | (mach_port_t process, mach_port_t refport, int fd, mach_port_t port); |
1593 | |
1594 | const mach_msg_type_t refportCheck = { |
1595 | /* msgt_name = */ 17, |
1596 | /* msgt_size = */ 32, |
1597 | /* msgt_number = */ 1, |
1598 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1599 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1600 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1601 | /* msgt_unused = */ 0 |
1602 | }; |
1603 | |
1604 | const mach_msg_type_t fdCheck = { |
1605 | /* msgt_name = */ 2, |
1606 | /* msgt_size = */ 32, |
1607 | /* msgt_number = */ 1, |
1608 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1609 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1610 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1611 | /* msgt_unused = */ 0 |
1612 | }; |
1613 | |
1614 | const mach_msg_type_t portCheck = { |
1615 | /* msgt_name = */ 17, |
1616 | /* msgt_size = */ 32, |
1617 | /* msgt_number = */ 1, |
1618 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1619 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1620 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1621 | /* msgt_unused = */ 0 |
1622 | }; |
1623 | |
1624 | mach_port_t process; |
1625 | mach_port_t refport; |
1626 | |
1627 | #if TypeCheck1 |
1628 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1629 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1630 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1631 | #endif /* TypeCheck */ |
1632 | |
1633 | #if TypeCheck1 |
1634 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1635 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1636 | #endif /* TypeCheck */ |
1637 | |
1638 | #if TypeCheck1 |
1639 | if (BAD_TYPECHECK(&In0P->fdType, &fdCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->fdType); _c.t = *(&fdCheck );_t.w != _c.w; })), 0)) |
1640 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1641 | #endif /* TypeCheck */ |
1642 | |
1643 | #if TypeCheck1 |
1644 | if (BAD_TYPECHECK(&In0P->portType, &portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->portType); _c.t = *(& portCheck);_t.w != _c.w; })), 0)) |
1645 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1646 | #endif /* TypeCheck */ |
1647 | |
1648 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1649 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1650 | else |
1651 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1652 | refport = In0P->refport; |
1653 | |
1654 | OutP->RetCode = S_msg_set_fd(process, refport, In0P->fd, In0P->port); |
1655 | } |
1656 | |
1657 | /* Default implementation of S_msg_set_fd */ |
1658 | #ifdef MIG_EOPNOTSUPP |
1659 | kern_return_t __attribute__ ((weak)) |
1660 | S_msg_set_fd |
1661 | ( |
1662 | mach_port_t process, |
1663 | mach_port_t refport, |
1664 | int fd, |
1665 | mach_port_t port |
1666 | ) { return MIG_EOPNOTSUPP; } |
1667 | #endif /* MIG_EOPNOTSUPP */ |
1668 | |
1669 | /* Routine msg_get_environment */ |
1670 | mig_internalstatic void _Xmsg_get_environment |
1671 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1672 | { |
1673 | typedef struct { |
1674 | mach_msg_header_t Head; |
1675 | } Request; |
1676 | |
1677 | typedef struct { |
1678 | mach_msg_header_t Head; |
1679 | mach_msg_type_t RetCodeType; |
1680 | kern_return_t RetCode; |
1681 | mach_msg_type_long_t valueType; |
1682 | char value[2048]; |
1683 | } Reply; |
1684 | |
1685 | Request *In0P = (Request *) InHeadP; |
1686 | Reply *OutP = (Reply *) OutHeadP; |
1687 | mig_external kern_return_t S_msg_get_environment |
1688 | (mach_port_t process, data_t *value, mach_msg_type_number_t *valueCnt); |
1689 | |
1690 | boolean_t msgh_simple = msgh_simple; |
1691 | const mach_msg_type_long_t valueType = { |
1692 | { |
1693 | /* msgt_name = */ 0, |
1694 | /* msgt_size = */ 0, |
1695 | /* msgt_number = */ 0, |
1696 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1697 | /* msgt_longform = */ TRUE((boolean_t) 1), |
1698 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1699 | /* msgt_unused = */ 0 |
1700 | }, |
1701 | /* msgtl_name = */ 8, |
1702 | /* msgtl_size = */ 8, |
1703 | /* msgtl_number = */ 2048, |
1704 | }; |
1705 | |
1706 | mach_port_t process; |
1707 | mach_msg_type_number_t valueCnt; |
1708 | |
1709 | char *valueP; |
1710 | |
1711 | #if TypeCheck1 |
1712 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1713 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1714 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1715 | #endif /* TypeCheck */ |
1716 | |
1717 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1718 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1719 | else |
1720 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1721 | valueP = OutP->value; |
1722 | valueCnt = 2048; |
1723 | |
1724 | OutP->RetCode = S_msg_get_environment(process, &valueP, &valueCnt); |
1725 | if (OutP->RetCode != KERN_SUCCESS0) |
1726 | return; |
1727 | |
1728 | msgh_simple = TRUE((boolean_t) 1); |
1729 | |
1730 | OutP->valueType = valueType; |
1731 | if (valueP != OutP->value) { |
1732 | OutP->valueType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1733 | OutP->valueType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1734 | *((char **)OutP->value) = valueP; |
1735 | msgh_simple = FALSE((boolean_t) 0); |
1736 | } |
1737 | |
1738 | OutP->valueType.msgtl_number = valueCnt; |
1739 | OutP->Head.msgh_size = 44 + ((OutP->valueType.msgtl_header.msgt_inline) ? (valueCnt + 3) & ~3 : sizeof(char *)); |
1740 | |
1741 | if (!msgh_simple) |
1742 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1743 | } |
1744 | |
1745 | /* Default implementation of S_msg_get_environment */ |
1746 | #ifdef MIG_EOPNOTSUPP |
1747 | kern_return_t __attribute__ ((weak)) |
1748 | S_msg_get_environment |
1749 | ( |
1750 | mach_port_t process, |
1751 | data_t *value, |
1752 | mach_msg_type_number_t *valueCnt |
1753 | ) { return MIG_EOPNOTSUPP; } |
1754 | #endif /* MIG_EOPNOTSUPP */ |
1755 | |
1756 | /* Routine msg_set_environment */ |
1757 | mig_internalstatic void _Xmsg_set_environment |
1758 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1759 | { |
1760 | typedef struct { |
1761 | mach_msg_header_t Head; |
1762 | mach_msg_type_t refportType; |
1763 | mach_port_t refport; |
1764 | mach_msg_type_long_t valueType; |
1765 | char value[2048]; |
1766 | } Request; |
1767 | |
1768 | typedef struct { |
1769 | mach_msg_header_t Head; |
1770 | mach_msg_type_t RetCodeType; |
1771 | kern_return_t RetCode; |
1772 | } Reply; |
1773 | |
1774 | Request *In0P = (Request *) InHeadP; |
1775 | Reply *OutP = (Reply *) OutHeadP; |
1776 | mig_external kern_return_t S_msg_set_environment |
1777 | (mach_port_t process, mach_port_t refport, data_t value, mach_msg_type_number_t valueCnt); |
1778 | |
1779 | unsigned int msgh_size; |
1780 | |
1781 | const mach_msg_type_t refportCheck = { |
1782 | /* msgt_name = */ 17, |
1783 | /* msgt_size = */ 32, |
1784 | /* msgt_number = */ 1, |
1785 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1786 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1787 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1788 | /* msgt_unused = */ 0 |
1789 | }; |
1790 | |
1791 | mach_port_t process; |
1792 | mach_port_t refport; |
1793 | |
1794 | #if TypeCheck1 |
1795 | msgh_size = In0P->Head.msgh_size; |
1796 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
1797 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
1798 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1799 | #endif /* TypeCheck */ |
1800 | |
1801 | #if TypeCheck1 |
1802 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
1803 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1804 | #endif /* TypeCheck */ |
1805 | |
1806 | #if TypeCheck1 |
1807 | if (mig_unlikely ((In0P->valueType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->valueType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valueType.msgtl_name != 8) || (In0P->valueType.msgtl_size != 8)), 0) |
1808 | (In0P->valueType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->valueType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valueType.msgtl_name != 8) || (In0P->valueType.msgtl_size != 8)), 0) |
1809 | (In0P->valueType.msgtl_size != 8))__builtin_expect (!! ((In0P->valueType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->valueType.msgtl_name != 8) || (In0P->valueType.msgtl_size != 8)), 0)) |
1810 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1811 | #endif /* TypeCheck */ |
1812 | |
1813 | #if TypeCheck1 |
1814 | if (mig_unlikely (msgh_size != 44 + ((In0P->valueType.msgtl_header.msgt_inline) ? (In0P->valueType.msgtl_number + 3) & ~3 : sizeof(char *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->valueType. msgtl_header.msgt_inline) ? (In0P->valueType.msgtl_number + 3) & ~3 : sizeof(char *))), 0)) |
1815 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1816 | #endif /* TypeCheck */ |
1817 | |
1818 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1819 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1820 | else |
1821 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1822 | refport = In0P->refport; |
1823 | |
1824 | OutP->RetCode = S_msg_set_environment(process, refport, (In0P->valueType.msgtl_header.msgt_inline) ? In0P->value : *((char **)In0P->value), In0P->valueType.msgtl_number); |
1825 | if (OutP->RetCode == KERN_SUCCESS0) |
1826 | if (!In0P->valueType.msgtl_header.msgt_inline) |
1827 | __mig_deallocate(* (vm_offset_t *) In0P->value, In0P->valueType.msgtl_number); |
1828 | } |
1829 | |
1830 | /* Default implementation of S_msg_set_environment */ |
1831 | #ifdef MIG_EOPNOTSUPP |
1832 | kern_return_t __attribute__ ((weak)) |
1833 | S_msg_set_environment |
1834 | ( |
1835 | mach_port_t process, |
1836 | mach_port_t refport, |
1837 | data_t value, |
1838 | mach_msg_type_number_t valueCnt |
1839 | ) { return MIG_EOPNOTSUPP; } |
1840 | #endif /* MIG_EOPNOTSUPP */ |
1841 | |
1842 | /* Routine msg_get_env_variable */ |
1843 | mig_internalstatic void _Xmsg_get_env_variable |
1844 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1845 | { |
1846 | typedef struct { |
1847 | mach_msg_header_t Head; |
1848 | mach_msg_type_t variableType; |
1849 | string_t variable; |
1850 | } Request; |
1851 | |
1852 | typedef struct { |
1853 | mach_msg_header_t Head; |
1854 | mach_msg_type_t RetCodeType; |
1855 | kern_return_t RetCode; |
1856 | mach_msg_type_long_t valueType; |
1857 | char value[2048]; |
1858 | } Reply; |
1859 | |
1860 | Request *In0P = (Request *) InHeadP; |
1861 | Reply *OutP = (Reply *) OutHeadP; |
1862 | mig_external kern_return_t S_msg_get_env_variable |
1863 | (mach_port_t process, string_t variable, data_t *value, mach_msg_type_number_t *valueCnt); |
1864 | |
1865 | boolean_t msgh_simple = msgh_simple; |
Value stored to 'msgh_simple' during its initialization is never read | |
1866 | const mach_msg_type_t variableCheck = { |
1867 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
1868 | /* msgt_size = */ 8, |
1869 | /* msgt_number = */ 1024, |
1870 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1871 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1872 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1873 | /* msgt_unused = */ 0 |
1874 | }; |
1875 | |
1876 | const mach_msg_type_long_t valueType = { |
1877 | { |
1878 | /* msgt_name = */ 0, |
1879 | /* msgt_size = */ 0, |
1880 | /* msgt_number = */ 0, |
1881 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1882 | /* msgt_longform = */ TRUE((boolean_t) 1), |
1883 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1884 | /* msgt_unused = */ 0 |
1885 | }, |
1886 | /* msgtl_name = */ 8, |
1887 | /* msgtl_size = */ 8, |
1888 | /* msgtl_number = */ 2048, |
1889 | }; |
1890 | |
1891 | mach_port_t process; |
1892 | mach_msg_type_number_t valueCnt; |
1893 | |
1894 | char *valueP; |
1895 | |
1896 | #if TypeCheck1 |
1897 | if (mig_unlikely ((In0P->Head.msgh_size != 1052) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1898 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1052) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1899 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1900 | #endif /* TypeCheck */ |
1901 | |
1902 | #if TypeCheck1 |
1903 | if (BAD_TYPECHECK(&In0P->variableType, &variableCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->variableType); _c.t = *( &variableCheck);_t.w != _c.w; })), 0)) |
1904 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1905 | #endif /* TypeCheck */ |
1906 | |
1907 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
1908 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
1909 | else |
1910 | process = In0P->Head.msgh_request_portmsgh_local_port; |
1911 | valueP = OutP->value; |
1912 | valueCnt = 2048; |
1913 | |
1914 | OutP->RetCode = S_msg_get_env_variable(process, In0P->variable, &valueP, &valueCnt); |
1915 | if (OutP->RetCode != KERN_SUCCESS0) |
1916 | return; |
1917 | |
1918 | msgh_simple = TRUE((boolean_t) 1); |
1919 | |
1920 | OutP->valueType = valueType; |
1921 | if (valueP != OutP->value) { |
1922 | OutP->valueType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1923 | OutP->valueType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1924 | *((char **)OutP->value) = valueP; |
1925 | msgh_simple = FALSE((boolean_t) 0); |
1926 | } |
1927 | |
1928 | OutP->valueType.msgtl_number = valueCnt; |
1929 | OutP->Head.msgh_size = 44 + ((OutP->valueType.msgtl_header.msgt_inline) ? (valueCnt + 3) & ~3 : sizeof(char *)); |
1930 | |
1931 | if (!msgh_simple) |
1932 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1933 | } |
1934 | |
1935 | /* Default implementation of S_msg_get_env_variable */ |
1936 | #ifdef MIG_EOPNOTSUPP |
1937 | kern_return_t __attribute__ ((weak)) |
1938 | S_msg_get_env_variable |
1939 | ( |
1940 | mach_port_t process, |
1941 | string_t variable, |
1942 | data_t *value, |
1943 | mach_msg_type_number_t *valueCnt |
1944 | ) { return MIG_EOPNOTSUPP; } |
1945 | #endif /* MIG_EOPNOTSUPP */ |
1946 | |
1947 | /* Routine msg_set_env_variable */ |
1948 | mig_internalstatic void _Xmsg_set_env_variable |
1949 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1950 | { |
1951 | typedef struct { |
1952 | mach_msg_header_t Head; |
1953 | mach_msg_type_t refportType; |
1954 | mach_port_t refport; |
1955 | mach_msg_type_t variableType; |
1956 | string_t variable; |
1957 | mach_msg_type_t valueType; |
1958 | string_t value; |
1959 | mach_msg_type_t replaceType; |
1960 | boolean_t replace; |
1961 | } Request; |
1962 | |
1963 | typedef struct { |
1964 | mach_msg_header_t Head; |
1965 | mach_msg_type_t RetCodeType; |
1966 | kern_return_t RetCode; |
1967 | } Reply; |
1968 | |
1969 | Request *In0P = (Request *) InHeadP; |
1970 | Reply *OutP = (Reply *) OutHeadP; |
1971 | mig_external kern_return_t S_msg_set_env_variable |
1972 | (mach_port_t process, mach_port_t refport, string_t variable, string_t value, boolean_t replace); |
1973 | |
1974 | const mach_msg_type_t refportCheck = { |
1975 | /* msgt_name = */ 17, |
1976 | /* msgt_size = */ 32, |
1977 | /* msgt_number = */ 1, |
1978 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1979 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1980 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1981 | /* msgt_unused = */ 0 |
1982 | }; |
1983 | |
1984 | const mach_msg_type_t variableCheck = { |
1985 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
1986 | /* msgt_size = */ 8, |
1987 | /* msgt_number = */ 1024, |
1988 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1989 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1990 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1991 | /* msgt_unused = */ 0 |
1992 | }; |
1993 | |
1994 | const mach_msg_type_t valueCheck = { |
1995 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
1996 | /* msgt_size = */ 8, |
1997 | /* msgt_number = */ 1024, |
1998 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1999 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2000 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2001 | /* msgt_unused = */ 0 |
2002 | }; |
2003 | |
2004 | const mach_msg_type_t replaceCheck = { |
2005 | /* msgt_name = */ 0, |
2006 | /* msgt_size = */ 32, |
2007 | /* msgt_number = */ 1, |
2008 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2009 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2010 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2011 | /* msgt_unused = */ 0 |
2012 | }; |
2013 | |
2014 | mach_port_t process; |
2015 | mach_port_t refport; |
2016 | |
2017 | #if TypeCheck1 |
2018 | if (mig_unlikely ((In0P->Head.msgh_size != 2096) ||__builtin_expect (!! ((In0P->Head.msgh_size != 2096) || !( In0P->Head.msgh_bits & 0x80000000U)), 0) |
2019 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 2096) || !( In0P->Head.msgh_bits & 0x80000000U)), 0)) |
2020 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2021 | #endif /* TypeCheck */ |
2022 | |
2023 | #if TypeCheck1 |
2024 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
2025 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2026 | #endif /* TypeCheck */ |
2027 | |
2028 | #if TypeCheck1 |
2029 | if (BAD_TYPECHECK(&In0P->variableType, &variableCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->variableType); _c.t = *( &variableCheck);_t.w != _c.w; })), 0)) |
2030 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2031 | #endif /* TypeCheck */ |
2032 | |
2033 | #if TypeCheck1 |
2034 | if (BAD_TYPECHECK(&In0P->valueType, &valueCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->valueType); _c.t = *(& valueCheck);_t.w != _c.w; })), 0)) |
2035 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2036 | #endif /* TypeCheck */ |
2037 | |
2038 | #if TypeCheck1 |
2039 | if (BAD_TYPECHECK(&In0P->replaceType, &replaceCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->replaceType); _c.t = *(& replaceCheck);_t.w != _c.w; })), 0)) |
2040 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2041 | #endif /* TypeCheck */ |
2042 | |
2043 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2044 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
2045 | else |
2046 | process = In0P->Head.msgh_request_portmsgh_local_port; |
2047 | refport = In0P->refport; |
2048 | |
2049 | OutP->RetCode = S_msg_set_env_variable(process, refport, In0P->variable, In0P->value, In0P->replace); |
2050 | } |
2051 | |
2052 | /* Default implementation of S_msg_set_env_variable */ |
2053 | #ifdef MIG_EOPNOTSUPP |
2054 | kern_return_t __attribute__ ((weak)) |
2055 | S_msg_set_env_variable |
2056 | ( |
2057 | mach_port_t process, |
2058 | mach_port_t refport, |
2059 | string_t variable, |
2060 | string_t value, |
2061 | boolean_t replace |
2062 | ) { return MIG_EOPNOTSUPP; } |
2063 | #endif /* MIG_EOPNOTSUPP */ |
2064 | |
2065 | /* Routine msg_sig_post_untraced */ |
2066 | mig_internalstatic void _Xmsg_sig_post_untraced |
2067 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2068 | { |
2069 | typedef struct { |
2070 | mach_msg_header_t Head; |
2071 | mach_msg_type_t signalType; |
2072 | int signal; |
2073 | mach_msg_type_t sigcodeType; |
2074 | natural_t sigcode; |
2075 | mach_msg_type_t refportType; |
2076 | mach_port_t refport; |
2077 | } Request; |
2078 | |
2079 | typedef struct { |
2080 | mach_msg_header_t Head; |
2081 | mach_msg_type_t RetCodeType; |
2082 | kern_return_t RetCode; |
2083 | } Reply; |
2084 | |
2085 | Request *In0P = (Request *) InHeadP; |
2086 | Reply *OutP = (Reply *) OutHeadP; |
2087 | mig_external kern_return_t S_msg_sig_post_untraced |
2088 | (mach_port_t process, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, int signal, natural_t sigcode, mach_port_t refport); |
2089 | |
2090 | const mach_msg_type_t signalCheck = { |
2091 | /* msgt_name = */ 2, |
2092 | /* msgt_size = */ 32, |
2093 | /* msgt_number = */ 1, |
2094 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2095 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2096 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2097 | /* msgt_unused = */ 0 |
2098 | }; |
2099 | |
2100 | const mach_msg_type_t sigcodeCheck = { |
2101 | /* msgt_name = */ 2, |
2102 | /* msgt_size = */ 32, |
2103 | /* msgt_number = */ 1, |
2104 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2105 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2106 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2107 | /* msgt_unused = */ 0 |
2108 | }; |
2109 | |
2110 | const mach_msg_type_t refportCheck = { |
2111 | /* msgt_name = */ 17, |
2112 | /* msgt_size = */ 32, |
2113 | /* msgt_number = */ 1, |
2114 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2115 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2116 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2117 | /* msgt_unused = */ 0 |
2118 | }; |
2119 | |
2120 | mach_port_t process; |
2121 | mach_port_t reply_port; |
2122 | mach_port_t refport; |
2123 | |
2124 | #if TypeCheck1 |
2125 | if (mig_unlikely ((In0P->Head.msgh_size != 48) ||__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2126 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 48) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2127 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2128 | #endif /* TypeCheck */ |
2129 | |
2130 | #if TypeCheck1 |
2131 | if (BAD_TYPECHECK(&In0P->signalType, &signalCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->signalType); _c.t = *(& signalCheck);_t.w != _c.w; })), 0)) |
2132 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2133 | #endif /* TypeCheck */ |
2134 | |
2135 | #if TypeCheck1 |
2136 | if (BAD_TYPECHECK(&In0P->sigcodeType, &sigcodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->sigcodeType); _c.t = *(& sigcodeCheck);_t.w != _c.w; })), 0)) |
2137 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2138 | #endif /* TypeCheck */ |
2139 | |
2140 | #if TypeCheck1 |
2141 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
2142 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2143 | #endif /* TypeCheck */ |
2144 | |
2145 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2146 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
2147 | else |
2148 | process = In0P->Head.msgh_request_portmsgh_local_port; |
2149 | reply_port = In0P->Head.msgh_reply_portmsgh_remote_port; |
2150 | |
2151 | refport = In0P->refport; |
2152 | |
2153 | OutP->RetCode = S_msg_sig_post_untraced(process, reply_port, MACH_MSGH_BITS_REPLY(In0P->Head.msgh_bits)((In0P->Head.msgh_bits) & 0x000000ff), In0P->signal, In0P->sigcode, refport); |
2154 | } |
2155 | |
2156 | /* Default implementation of S_msg_sig_post_untraced */ |
2157 | #ifdef MIG_EOPNOTSUPP |
2158 | kern_return_t __attribute__ ((weak)) |
2159 | S_msg_sig_post_untraced |
2160 | ( |
2161 | mach_port_t process, |
2162 | mach_port_t reply_port, |
2163 | mach_msg_type_name_t reply_portPoly, |
2164 | int signal, |
2165 | natural_t sigcode, |
2166 | mach_port_t refport |
2167 | ) { return MIG_EOPNOTSUPP; } |
2168 | #endif /* MIG_EOPNOTSUPP */ |
2169 | |
2170 | /* Routine msg_report_wait */ |
2171 | mig_internalstatic void _Xmsg_report_wait |
2172 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2173 | { |
2174 | typedef struct { |
2175 | mach_msg_header_t Head; |
2176 | mach_msg_type_t threadType; |
2177 | mach_port_t thread; |
2178 | } Request; |
2179 | |
2180 | typedef struct { |
2181 | mach_msg_header_t Head; |
2182 | mach_msg_type_t RetCodeType; |
2183 | kern_return_t RetCode; |
2184 | mach_msg_type_t wait_descType; |
2185 | string_t wait_desc; |
2186 | mach_msg_type_t wait_rpcType; |
2187 | mach_msg_id_t wait_rpc; |
2188 | } Reply; |
2189 | |
2190 | Request *In0P = (Request *) InHeadP; |
2191 | Reply *OutP = (Reply *) OutHeadP; |
2192 | mig_external kern_return_t S_msg_report_wait |
2193 | (mach_port_t process, mach_port_t thread, string_t wait_desc, mach_msg_id_t *wait_rpc); |
2194 | |
2195 | const mach_msg_type_t threadCheck = { |
2196 | /* msgt_name = */ 17, |
2197 | /* msgt_size = */ 32, |
2198 | /* msgt_number = */ 1, |
2199 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2200 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2201 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2202 | /* msgt_unused = */ 0 |
2203 | }; |
2204 | |
2205 | const mach_msg_type_t wait_descType = { |
2206 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
2207 | /* msgt_size = */ 8, |
2208 | /* msgt_number = */ 1024, |
2209 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2210 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2211 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2212 | /* msgt_unused = */ 0 |
2213 | }; |
2214 | |
2215 | const mach_msg_type_t wait_rpcType = { |
2216 | /* msgt_name = */ 2, |
2217 | /* msgt_size = */ 32, |
2218 | /* msgt_number = */ 1, |
2219 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2220 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2221 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2222 | /* msgt_unused = */ 0 |
2223 | }; |
2224 | |
2225 | mach_port_t process; |
2226 | |
2227 | #if TypeCheck1 |
2228 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
2229 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
2230 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2231 | #endif /* TypeCheck */ |
2232 | |
2233 | #if TypeCheck1 |
2234 | if (BAD_TYPECHECK(&In0P->threadType, &threadCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->threadType); _c.t = *(& threadCheck);_t.w != _c.w; })), 0)) |
2235 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2236 | #endif /* TypeCheck */ |
2237 | |
2238 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2239 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
2240 | else |
2241 | process = In0P->Head.msgh_request_portmsgh_local_port; |
2242 | OutP->RetCode = S_msg_report_wait(process, In0P->thread, OutP->wait_desc, &OutP->wait_rpc); |
2243 | if (OutP->RetCode != KERN_SUCCESS0) |
2244 | return; |
2245 | |
2246 | OutP->Head.msgh_size = 1068; |
2247 | |
2248 | OutP->wait_descType = wait_descType; |
2249 | |
2250 | OutP->wait_rpcType = wait_rpcType; |
2251 | } |
2252 | |
2253 | /* Default implementation of S_msg_report_wait */ |
2254 | #ifdef MIG_EOPNOTSUPP |
2255 | kern_return_t __attribute__ ((weak)) |
2256 | S_msg_report_wait |
2257 | ( |
2258 | mach_port_t process, |
2259 | mach_port_t thread, |
2260 | string_t wait_desc, |
2261 | mach_msg_id_t *wait_rpc |
2262 | ) { return MIG_EOPNOTSUPP; } |
2263 | #endif /* MIG_EOPNOTSUPP */ |
2264 | |
2265 | /* Routine msg_describe_ports */ |
2266 | mig_internalstatic void _Xmsg_describe_ports |
2267 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2268 | { |
2269 | typedef struct { |
2270 | mach_msg_header_t Head; |
2271 | mach_msg_type_t refportType; |
2272 | mach_port_t refport; |
2273 | mach_msg_type_long_t namesType; |
2274 | mach_port_t names[512]; |
2275 | } Request; |
2276 | |
2277 | typedef struct { |
2278 | mach_msg_header_t Head; |
2279 | mach_msg_type_t RetCodeType; |
2280 | kern_return_t RetCode; |
2281 | mach_msg_type_long_t descriptionsType; |
2282 | char descriptions[2048]; |
2283 | } Reply; |
2284 | |
2285 | Request *In0P = (Request *) InHeadP; |
2286 | Reply *OutP = (Reply *) OutHeadP; |
2287 | mig_external kern_return_t S_msg_describe_ports |
2288 | (mach_port_t process, mach_port_t refport, mach_port_array_t names, mach_msg_type_number_t namesCnt, data_t *descriptions, mach_msg_type_number_t *descriptionsCnt); |
2289 | |
2290 | boolean_t msgh_simple = msgh_simple; |
2291 | unsigned int msgh_size; |
2292 | |
2293 | const mach_msg_type_t refportCheck = { |
2294 | /* msgt_name = */ 17, |
2295 | /* msgt_size = */ 32, |
2296 | /* msgt_number = */ 1, |
2297 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2298 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2299 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2300 | /* msgt_unused = */ 0 |
2301 | }; |
2302 | |
2303 | const mach_msg_type_long_t descriptionsType = { |
2304 | { |
2305 | /* msgt_name = */ 0, |
2306 | /* msgt_size = */ 0, |
2307 | /* msgt_number = */ 0, |
2308 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2309 | /* msgt_longform = */ TRUE((boolean_t) 1), |
2310 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2311 | /* msgt_unused = */ 0 |
2312 | }, |
2313 | /* msgtl_name = */ 8, |
2314 | /* msgtl_size = */ 8, |
2315 | /* msgtl_number = */ 2048, |
2316 | }; |
2317 | |
2318 | mach_port_t process; |
2319 | mach_port_t refport; |
2320 | mach_msg_type_number_t descriptionsCnt; |
2321 | |
2322 | char *descriptionsP; |
2323 | |
2324 | #if TypeCheck1 |
2325 | msgh_size = In0P->Head.msgh_size; |
2326 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
2327 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
2328 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2329 | #endif /* TypeCheck */ |
2330 | |
2331 | #if TypeCheck1 |
2332 | if (BAD_TYPECHECK(&In0P->refportType, &refportCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->refportType); _c.t = *(& refportCheck);_t.w != _c.w; })), 0)) |
2333 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2334 | #endif /* TypeCheck */ |
2335 | |
2336 | #if TypeCheck1 |
2337 | if (mig_unlikely ((In0P->namesType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->namesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->namesType.msgtl_name != 15) || (In0P->namesType.msgtl_size != 32)), 0) |
2338 | (In0P->namesType.msgtl_name != 15) ||__builtin_expect (!! ((In0P->namesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->namesType.msgtl_name != 15) || (In0P->namesType.msgtl_size != 32)), 0) |
2339 | (In0P->namesType.msgtl_size != 32))__builtin_expect (!! ((In0P->namesType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->namesType.msgtl_name != 15) || (In0P->namesType.msgtl_size != 32)), 0)) |
2340 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2341 | #endif /* TypeCheck */ |
2342 | |
2343 | #if TypeCheck1 |
2344 | if (mig_unlikely (msgh_size != 44 + ((In0P->namesType.msgtl_header.msgt_inline) ? 4 * In0P->namesType.msgtl_number : sizeof(mach_port_t *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->namesType. msgtl_header.msgt_inline) ? 4 * In0P->namesType.msgtl_number : sizeof(mach_port_t *))), 0)) |
2345 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
2346 | #endif /* TypeCheck */ |
2347 | |
2348 | if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23) |
2349 | process = ports_payload_get_name(In0P->Head.msgh_protected_payload); |
2350 | else |
2351 | process = In0P->Head.msgh_request_portmsgh_local_port; |
2352 | refport = In0P->refport; |
2353 | |
2354 | descriptionsP = OutP->descriptions; |
2355 | descriptionsCnt = 2048; |
2356 | |
2357 | OutP->RetCode = S_msg_describe_ports(process, refport, (In0P->namesType.msgtl_header.msgt_inline) ? In0P->names : *((mach_port_t **)In0P->names), In0P->namesType.msgtl_number, &descriptionsP, &descriptionsCnt); |
2358 | if (OutP->RetCode == KERN_SUCCESS0) |
2359 | if (!In0P->namesType.msgtl_header.msgt_inline) |
2360 | __mig_deallocate(* (vm_offset_t *) In0P->names, 4 * In0P->namesType.msgtl_number); |
2361 | if (OutP->RetCode != KERN_SUCCESS0) |
2362 | return; |
2363 | |
2364 | msgh_simple = TRUE((boolean_t) 1); |
2365 | |
2366 | OutP->descriptionsType = descriptionsType; |
2367 | if (descriptionsP != OutP->descriptions) { |
2368 | OutP->descriptionsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
2369 | *((char **)OutP->descriptions) = descriptionsP; |
2370 | msgh_simple = FALSE((boolean_t) 0); |
2371 | } |
2372 | |
2373 | OutP->descriptionsType.msgtl_number = descriptionsCnt; |
2374 | OutP->Head.msgh_size = 44 + ((OutP->descriptionsType.msgtl_header.msgt_inline) ? (descriptionsCnt + 3) & ~3 : sizeof(char *)); |
2375 | |
2376 | if (!msgh_simple) |
2377 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
2378 | } |
2379 | |
2380 | /* Default implementation of S_msg_describe_ports */ |
2381 | #ifdef MIG_EOPNOTSUPP |
2382 | kern_return_t __attribute__ ((weak)) |
2383 | S_msg_describe_ports |
2384 | ( |
2385 | mach_port_t process, |
2386 | mach_port_t refport, |
2387 | mach_port_array_t names, |
2388 | mach_msg_type_number_t namesCnt, |
2389 | data_t *descriptions, |
2390 | mach_msg_type_number_t *descriptionsCnt |
2391 | ) { return MIG_EOPNOTSUPP; } |
2392 | #endif /* MIG_EOPNOTSUPP */ |
2393 | |
2394 | mig_routine_t msg_server_routines[] = { |
2395 | _Xmsg_sig_post, |
2396 | _Xmsg_proc_newids, |
2397 | _Xmsg_add_auth, |
2398 | _Xmsg_del_auth, |
2399 | _Xmsg_get_init_port, |
2400 | _Xmsg_set_init_port, |
2401 | _Xmsg_get_init_ports, |
2402 | _Xmsg_set_init_ports, |
2403 | _Xmsg_get_init_int, |
2404 | _Xmsg_set_init_int, |
2405 | _Xmsg_get_init_ints, |
2406 | _Xmsg_set_init_ints, |
2407 | _Xmsg_get_dtable, |
2408 | _Xmsg_set_dtable, |
2409 | _Xmsg_get_fd, |
2410 | _Xmsg_set_fd, |
2411 | _Xmsg_get_environment, |
2412 | _Xmsg_set_environment, |
2413 | _Xmsg_get_env_variable, |
2414 | _Xmsg_set_env_variable, |
2415 | 0, |
2416 | 0, |
2417 | _Xmsg_sig_post_untraced, |
2418 | _Xmsg_report_wait, |
2419 | _Xmsg_describe_ports, |
2420 | }; |
2421 | |
2422 | mig_external boolean_t msg_server |
2423 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
2424 | { |
2425 | mach_msg_header_t *InP = InHeadP; |
2426 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
2427 | |
2428 | const mach_msg_type_t RetCodeType = { |
2429 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
2430 | /* msgt_size = */ 32, |
2431 | /* msgt_number = */ 1, |
2432 | /* msgt_inline = */ TRUE((boolean_t) 1), |
2433 | /* msgt_longform = */ FALSE((boolean_t) 0), |
2434 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
2435 | /* msgt_unused = */ 0 |
2436 | }; |
2437 | |
2438 | mig_routine_t routine; |
2439 | |
2440 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
2441 | OutP->Head.msgh_size = sizeof *OutP; |
2442 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
2443 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
2444 | OutP->Head.msgh_seqno = 0; |
2445 | OutP->Head.msgh_id = InP->msgh_id + 100; |
2446 | |
2447 | OutP->RetCodeType = RetCodeType; |
2448 | |
2449 | if ((InP->msgh_id > 23024) || (InP->msgh_id < 23000) || |
2450 | ((routine = msg_server_routines[InP->msgh_id - 23000]) == 0)) { |
2451 | OutP->RetCode = MIG_BAD_ID-303; |
2452 | return FALSE((boolean_t) 0); |
2453 | } |
2454 | (*routine) (InP, &OutP->Head); |
2455 | return TRUE((boolean_t) 1); |
2456 | } |
2457 | |
2458 | mig_external mig_routine_t msg_server_routine |
2459 | (const mach_msg_header_t *InHeadP) |
2460 | { |
2461 | int msgh_id; |
2462 | |
2463 | msgh_id = InHeadP->msgh_id - 23000; |
2464 | |
2465 | if ((msgh_id > 24) || (msgh_id < 0)) |
2466 | return 0; |
2467 | |
2468 | return msg_server_routines[msgh_id]; |
2469 | } |
2470 |