Bug Summary

File:obj-scan-build/startup/msgServer.c
Location:line 631, column 12
Description:Value stored to 'msgh_simple' during its initialization is never read

Annotated Source Code

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