Bug Summary

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

Annotated Source Code

1/* Module startup */
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 startup_essential_task */
54mig_internalstatic void _Xstartup_essential_task
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 taskType;
60 mach_port_t task;
61 mach_msg_type_t excptType;
62 mach_port_t excpt;
63 mach_msg_type_t nameType;
64 string_t name;
65 mach_msg_type_t credentialType;
66 mach_port_t credential;
67 } Request;
68
69 typedef struct {
70 mach_msg_header_t Head;
71 mach_msg_type_t RetCodeType;
72 kern_return_t RetCode;
73 } Reply;
74
75 Request *In0P = (Request *) InHeadP;
76 Reply *OutP = (Reply *) OutHeadP;
77 mig_external kern_return_t S_startup_essential_task
78 (startup_t server, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t task, mach_port_t excpt, string_t name, mach_port_t credential);
79
80 const mach_msg_type_t taskCheck = {
81 /* msgt_name = */ 17,
82 /* msgt_size = */ 32,
83 /* msgt_number = */ 1,
84 /* msgt_inline = */ TRUE((boolean_t) 1),
85 /* msgt_longform = */ FALSE((boolean_t) 0),
86 /* msgt_deallocate = */ FALSE((boolean_t) 0),
87 /* msgt_unused = */ 0
88 };
89
90 const mach_msg_type_t excptCheck = {
91 /* msgt_name = */ 16,
92 /* msgt_size = */ 32,
93 /* msgt_number = */ 1,
94 /* msgt_inline = */ TRUE((boolean_t) 1),
95 /* msgt_longform = */ FALSE((boolean_t) 0),
96 /* msgt_deallocate = */ FALSE((boolean_t) 0),
97 /* msgt_unused = */ 0
98 };
99
100 const mach_msg_type_t nameCheck = {
101 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
102 /* msgt_size = */ 8,
103 /* msgt_number = */ 1024,
104 /* msgt_inline = */ TRUE((boolean_t) 1),
105 /* msgt_longform = */ FALSE((boolean_t) 0),
106 /* msgt_deallocate = */ FALSE((boolean_t) 0),
107 /* msgt_unused = */ 0
108 };
109
110 const mach_msg_type_t credentialCheck = {
111 /* msgt_name = */ 17,
112 /* msgt_size = */ 32,
113 /* msgt_number = */ 1,
114 /* msgt_inline = */ TRUE((boolean_t) 1),
115 /* msgt_longform = */ FALSE((boolean_t) 0),
116 /* msgt_deallocate = */ FALSE((boolean_t) 0),
117 /* msgt_unused = */ 0
118 };
119
120#if TypeCheck1
121 if (mig_unlikely ((In0P->Head.msgh_size != 1076) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1076) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
122 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1076) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
)
123 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
124#endif /* TypeCheck */
125
126#if TypeCheck1
127 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)
)
128 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
129#endif /* TypeCheck */
130
131#if TypeCheck1
132 if (BAD_TYPECHECK(&In0P->excptType, &excptCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->excptType); _c.t = *(&
excptCheck);_t.w != _c.w; })), 0)
)
133 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
134#endif /* TypeCheck */
135
136#if TypeCheck1
137 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
138 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
139#endif /* TypeCheck */
140
141#if TypeCheck1
142 if (BAD_TYPECHECK(&In0P->credentialType, &credentialCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->credentialType); _c.t = *
(&credentialCheck);_t.w != _c.w; })), 0)
)
143 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
144#endif /* TypeCheck */
145
146 OutP->RetCode = S_startup_essential_task(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->task, In0P->excpt, In0P->name, In0P->credential);
147}
148
149/* Default implementation of S_startup_essential_task */
150#ifdef MIG_EOPNOTSUPP
151kern_return_t __attribute__ ((weak))
152S_startup_essential_task
153(
154 startup_t server,
155 mach_port_t reply_port,
156 mach_msg_type_name_t reply_portPoly,
157 mach_port_t task,
158 mach_port_t excpt,
159 string_t name,
160 mach_port_t credential
161) { return MIG_EOPNOTSUPP; }
162#endif /* MIG_EOPNOTSUPP */
163
164/* Routine startup_request_notification */
165mig_internalstatic void _Xstartup_request_notification
166 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
167{
168 typedef struct {
169 mach_msg_header_t Head;
170 mach_msg_type_t notify_portType;
171 mach_port_t notify_port;
172 mach_msg_type_t nameType;
173 string_t name;
174 } Request;
175
176 typedef struct {
177 mach_msg_header_t Head;
178 mach_msg_type_t RetCodeType;
179 kern_return_t RetCode;
180 } Reply;
181
182 Request *In0P = (Request *) InHeadP;
183 Reply *OutP = (Reply *) OutHeadP;
184 mig_external kern_return_t S_startup_request_notification
185 (startup_t server, mach_port_t notify_port, string_t name);
186
187 const mach_msg_type_t notify_portCheck = {
188 /* msgt_name = */ 17,
189 /* msgt_size = */ 32,
190 /* msgt_number = */ 1,
191 /* msgt_inline = */ TRUE((boolean_t) 1),
192 /* msgt_longform = */ FALSE((boolean_t) 0),
193 /* msgt_deallocate = */ FALSE((boolean_t) 0),
194 /* msgt_unused = */ 0
195 };
196
197 const mach_msg_type_t nameCheck = {
198 /* msgt_name = */ MACH_MSG_TYPE_STRING_C12,
199 /* msgt_size = */ 8,
200 /* msgt_number = */ 1024,
201 /* msgt_inline = */ TRUE((boolean_t) 1),
202 /* msgt_longform = */ FALSE((boolean_t) 0),
203 /* msgt_deallocate = */ FALSE((boolean_t) 0),
204 /* msgt_unused = */ 0
205 };
206
207#if TypeCheck1
208 if (mig_unlikely ((In0P->Head.msgh_size != 1060) ||__builtin_expect (!! ((In0P->Head.msgh_size != 1060) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
209 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 1060) || !(
In0P->Head.msgh_bits & 0x80000000U)), 0)
)
210 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
211#endif /* TypeCheck */
212
213#if TypeCheck1
214 if (BAD_TYPECHECK(&In0P->notify_portType, &notify_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->notify_portType); _c.t =
*(&notify_portCheck);_t.w != _c.w; })), 0)
)
215 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
216#endif /* TypeCheck */
217
218#if TypeCheck1
219 if (BAD_TYPECHECK(&In0P->nameType, &nameCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->nameType); _c.t = *(&
nameCheck);_t.w != _c.w; })), 0)
)
220 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
221#endif /* TypeCheck */
222
223 OutP->RetCode = S_startup_request_notification(In0P->Head.msgh_request_portmsgh_local_port, In0P->notify_port, In0P->name);
224}
225
226/* Default implementation of S_startup_request_notification */
227#ifdef MIG_EOPNOTSUPP
228kern_return_t __attribute__ ((weak))
229S_startup_request_notification
230(
231 startup_t server,
232 mach_port_t notify_port,
233 string_t name
234) { return MIG_EOPNOTSUPP; }
235#endif /* MIG_EOPNOTSUPP */
236
237/* Routine startup_reboot */
238mig_internalstatic void _Xstartup_reboot
239 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
240{
241 typedef struct {
242 mach_msg_header_t Head;
243 mach_msg_type_t refportType;
244 mach_port_t refport;
245 mach_msg_type_t reboot_codeType;
246 int reboot_code;
247 } Request;
248
249 typedef struct {
250 mach_msg_header_t Head;
251 mach_msg_type_t RetCodeType;
252 kern_return_t RetCode;
253 } Reply;
254
255 Request *In0P = (Request *) InHeadP;
256 Reply *OutP = (Reply *) OutHeadP;
257 mig_external kern_return_t S_startup_reboot
258 (startup_t server, mach_port_t refport, int reboot_code);
259
260 const mach_msg_type_t refportCheck = {
261 /* msgt_name = */ 17,
262 /* msgt_size = */ 32,
263 /* msgt_number = */ 1,
264 /* msgt_inline = */ TRUE((boolean_t) 1),
265 /* msgt_longform = */ FALSE((boolean_t) 0),
266 /* msgt_deallocate = */ FALSE((boolean_t) 0),
267 /* msgt_unused = */ 0
268 };
269
270 const mach_msg_type_t reboot_codeCheck = {
271 /* msgt_name = */ 2,
272 /* msgt_size = */ 32,
273 /* msgt_number = */ 1,
274 /* msgt_inline = */ TRUE((boolean_t) 1),
275 /* msgt_longform = */ FALSE((boolean_t) 0),
276 /* msgt_deallocate = */ FALSE((boolean_t) 0),
277 /* msgt_unused = */ 0
278 };
279
280#if TypeCheck1
281 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
282 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
283 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
284#endif /* TypeCheck */
285
286#if TypeCheck1
287 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)
)
288 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
289#endif /* TypeCheck */
290
291#if TypeCheck1
292 if (BAD_TYPECHECK(&In0P->reboot_codeType, &reboot_codeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->reboot_codeType); _c.t =
*(&reboot_codeCheck);_t.w != _c.w; })), 0)
)
293 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
294#endif /* TypeCheck */
295
296 OutP->RetCode = S_startup_reboot(In0P->Head.msgh_request_portmsgh_local_port, In0P->refport, In0P->reboot_code);
297}
298
299/* Default implementation of S_startup_reboot */
300#ifdef MIG_EOPNOTSUPP
301kern_return_t __attribute__ ((weak))
302S_startup_reboot
303(
304 startup_t server,
305 mach_port_t refport,
306 int reboot_code
307) { return MIG_EOPNOTSUPP; }
308#endif /* MIG_EOPNOTSUPP */
309
310/* Routine startup_procinit */
311mig_internalstatic void _Xstartup_procinit
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 startup_procType;
317 process_t startup_proc;
318 } Request;
319
320 typedef struct {
321 mach_msg_header_t Head;
322 mach_msg_type_t RetCodeType;
323 kern_return_t RetCode;
324 mach_msg_type_t startup_taskType;
325 mach_port_t startup_task;
326 mach_msg_type_t authType;
327 auth_t auth;
328 mach_msg_type_t host_privType;
329 mach_port_t host_priv;
330 mach_msg_type_t device_masterType;
331 mach_port_t device_master;
332 } Reply;
333
334 Request *In0P = (Request *) InHeadP;
335 Reply *OutP = (Reply *) OutHeadP;
336 mig_external kern_return_t S_startup_procinit
337 (startup_t server, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, process_t startup_proc, mach_port_t *startup_task, auth_t *auth, mach_port_t *host_priv, mach_msg_type_name_t *host_privPoly, mach_port_t *device_master, mach_msg_type_name_t *device_masterPoly);
338
339 const mach_msg_type_t startup_procCheck = {
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 const mach_msg_type_t startup_taskType = {
350 /* msgt_name = */ 19,
351 /* msgt_size = */ 32,
352 /* msgt_number = */ 1,
353 /* msgt_inline = */ TRUE((boolean_t) 1),
354 /* msgt_longform = */ FALSE((boolean_t) 0),
355 /* msgt_deallocate = */ FALSE((boolean_t) 0),
356 /* msgt_unused = */ 0
357 };
358
359 const mach_msg_type_t authType = {
360 /* msgt_name = */ 19,
361 /* msgt_size = */ 32,
362 /* msgt_number = */ 1,
363 /* msgt_inline = */ TRUE((boolean_t) 1),
364 /* msgt_longform = */ FALSE((boolean_t) 0),
365 /* msgt_deallocate = */ FALSE((boolean_t) 0),
366 /* msgt_unused = */ 0
367 };
368
369 const mach_msg_type_t host_privType = {
370 /* msgt_name = */ -1,
371 /* msgt_size = */ 32,
372 /* msgt_number = */ 1,
373 /* msgt_inline = */ TRUE((boolean_t) 1),
374 /* msgt_longform = */ FALSE((boolean_t) 0),
375 /* msgt_deallocate = */ FALSE((boolean_t) 0),
376 /* msgt_unused = */ 0
377 };
378
379 const mach_msg_type_t device_masterType = {
380 /* msgt_name = */ -1,
381 /* msgt_size = */ 32,
382 /* msgt_number = */ 1,
383 /* msgt_inline = */ TRUE((boolean_t) 1),
384 /* msgt_longform = */ FALSE((boolean_t) 0),
385 /* msgt_deallocate = */ FALSE((boolean_t) 0),
386 /* msgt_unused = */ 0
387 };
388
389 mach_msg_type_name_t host_privPoly;
390 mach_msg_type_name_t device_masterPoly;
391
392#if TypeCheck1
393 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
394 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
395 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
396#endif /* TypeCheck */
397
398#if TypeCheck1
399 if (BAD_TYPECHECK(&In0P->startup_procType, &startup_procCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->startup_procType); _c.t =
*(&startup_procCheck);_t.w != _c.w; })), 0)
)
400 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
401#endif /* TypeCheck */
402
403 OutP->RetCode = S_startup_procinit(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->startup_proc, &OutP->startup_task, &OutP->auth, &OutP->host_priv, &host_privPoly, &OutP->device_master, &device_masterPoly);
404 if (OutP->RetCode != KERN_SUCCESS0)
405 return;
406
407 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
408 OutP->Head.msgh_size = 64;
409
410 OutP->startup_taskType = startup_taskType;
411
412 OutP->authType = authType;
413
414 OutP->host_privType = host_privType;
415
416 OutP->host_privType.msgt_name = host_privPoly;
417
418 OutP->device_masterType = device_masterType;
419
420 OutP->device_masterType.msgt_name = device_masterPoly;
421}
422
423/* Default implementation of S_startup_procinit */
424#ifdef MIG_EOPNOTSUPP
425kern_return_t __attribute__ ((weak))
426S_startup_procinit
427(
428 startup_t server,
429 mach_port_t reply_port,
430 mach_msg_type_name_t reply_portPoly,
431 process_t startup_proc,
432 mach_port_t *startup_task,
433 auth_t *auth,
434 mach_port_t *host_priv,
435 mach_msg_type_name_t *host_privPoly,
436 mach_port_t *device_master,
437 mach_msg_type_name_t *device_masterPoly
438) { return MIG_EOPNOTSUPP; }
439#endif /* MIG_EOPNOTSUPP */
440
441/* Routine startup_authinit */
442mig_internalstatic void _Xstartup_authinit
443 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
444{
445 typedef struct {
446 mach_msg_header_t Head;
447 mach_msg_type_t authType;
448 mach_port_t auth;
449 } Request;
450
451 typedef struct {
452 mach_msg_header_t Head;
453 mach_msg_type_t RetCodeType;
454 kern_return_t RetCode;
455 mach_msg_type_t procType;
456 mach_port_t proc;
457 } Reply;
458
459 Request *In0P = (Request *) InHeadP;
460 Reply *OutP = (Reply *) OutHeadP;
461 mig_external kern_return_t S_startup_authinit
462 (startup_t server, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t auth, mach_port_t *proc, mach_msg_type_name_t *procPoly);
463
464 boolean_t msgh_simple = msgh_simple;
Value stored to 'msgh_simple' during its initialization is never read
465 const mach_msg_type_t authCheck = {
466 /* msgt_name = */ 17,
467 /* msgt_size = */ 32,
468 /* msgt_number = */ 1,
469 /* msgt_inline = */ TRUE((boolean_t) 1),
470 /* msgt_longform = */ FALSE((boolean_t) 0),
471 /* msgt_deallocate = */ FALSE((boolean_t) 0),
472 /* msgt_unused = */ 0
473 };
474
475 const mach_msg_type_t procType = {
476 /* msgt_name = */ -1,
477 /* msgt_size = */ 32,
478 /* msgt_number = */ 1,
479 /* msgt_inline = */ TRUE((boolean_t) 1),
480 /* msgt_longform = */ FALSE((boolean_t) 0),
481 /* msgt_deallocate = */ FALSE((boolean_t) 0),
482 /* msgt_unused = */ 0
483 };
484
485 mach_msg_type_name_t procPoly;
486
487#if TypeCheck1
488 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
489 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
490 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
491#endif /* TypeCheck */
492
493#if TypeCheck1
494 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)
)
495 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
496#endif /* TypeCheck */
497
498 OutP->RetCode = S_startup_authinit(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->auth, &OutP->proc, &procPoly);
499 if (OutP->RetCode != KERN_SUCCESS0)
500 return;
501
502 msgh_simple = TRUE((boolean_t) 1);
503 OutP->Head.msgh_size = 40;
504
505 OutP->procType = procType;
506
507 if (MACH_MSG_TYPE_PORT_ANY(procPoly)(((procPoly) >= 16) && ((procPoly) <= 21)))
508 msgh_simple = FALSE((boolean_t) 0);
509
510 OutP->procType.msgt_name = procPoly;
511
512 if (!msgh_simple)
513 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
514}
515
516/* Default implementation of S_startup_authinit */
517#ifdef MIG_EOPNOTSUPP
518kern_return_t __attribute__ ((weak))
519S_startup_authinit
520(
521 startup_t server,
522 mach_port_t reply_port,
523 mach_msg_type_name_t reply_portPoly,
524 mach_port_t auth,
525 mach_port_t *proc,
526 mach_msg_type_name_t *procPoly
527) { return MIG_EOPNOTSUPP; }
528#endif /* MIG_EOPNOTSUPP */
529
530mig_routine_t startup_server_routines[] = {
531 _Xstartup_essential_task,
532 _Xstartup_request_notification,
533 _Xstartup_reboot,
534 _Xstartup_procinit,
535 _Xstartup_authinit,
536};
537
538mig_external boolean_t startup_server
539 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
540{
541 mach_msg_header_t *InP = InHeadP;
542 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
543
544 const mach_msg_type_t RetCodeType = {
545 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
546 /* msgt_size = */ 32,
547 /* msgt_number = */ 1,
548 /* msgt_inline = */ TRUE((boolean_t) 1),
549 /* msgt_longform = */ FALSE((boolean_t) 0),
550 /* msgt_deallocate = */ FALSE((boolean_t) 0),
551 /* msgt_unused = */ 0
552 };
553
554 mig_routine_t routine;
555
556 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8));
557 OutP->Head.msgh_size = sizeof *OutP;
558 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port;
559 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
560 OutP->Head.msgh_seqno = 0;
561 OutP->Head.msgh_id = InP->msgh_id + 100;
562
563 OutP->RetCodeType = RetCodeType;
564
565 if ((InP->msgh_id > 29004) || (InP->msgh_id < 29000) ||
566 ((routine = startup_server_routines[InP->msgh_id - 29000]) == 0)) {
567 OutP->RetCode = MIG_BAD_ID-303;
568 return FALSE((boolean_t) 0);
569 }
570 (*routine) (InP, &OutP->Head);
571 return TRUE((boolean_t) 1);
572}
573
574mig_external mig_routine_t startup_server_routine
575 (const mach_msg_header_t *InHeadP)
576{
577 int msgh_id;
578
579 msgh_id = InHeadP->msgh_id - 29000;
580
581 if ((msgh_id > 4) || (msgh_id < 0))
582 return 0;
583
584 return startup_server_routines[msgh_id];
585}
586