Bug Summary

File:obj-scan-build/mach-defpager/default_pagerServer.c
Location:line 386, column 12
Description:Value stored to 'msgh_simple' during its initialization is never read

Annotated Source Code

1/* Module default_pager */
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#include <mach/default_pager_types.h>
53#include <hurd/default_pager_types.h>
54#include "mig-decls.h"
55
56/* Routine default_pager_object_create */
57mig_internalstatic void _Xdefault_pager_object_create
58 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
59{
60 typedef struct {
61 mach_msg_header_t Head;
62 mach_msg_type_t object_sizeType;
63 vm_size_t object_size;
64 } Request;
65
66 typedef struct {
67 mach_msg_header_t Head;
68 mach_msg_type_t RetCodeType;
69 kern_return_t RetCode;
70 mach_msg_type_t memory_objectType;
71 memory_object_t memory_object;
72 } Reply;
73
74 Request *In0P = (Request *) InHeadP;
75 Reply *OutP = (Reply *) OutHeadP;
76 mig_external kern_return_t S_default_pager_object_create
77 (mach_port_t default_pager, memory_object_t *memory_object, mach_msg_type_name_t *memory_objectPoly, vm_size_t object_size);
78
79 boolean_t msgh_simple = msgh_simple;
80 const mach_msg_type_t object_sizeCheck = {
81 /* msgt_name = */ 2,
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 memory_objectType = {
91 /* msgt_name = */ -1,
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 mach_msg_type_name_t memory_objectPoly;
101
102#if TypeCheck1
103 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
104 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
105 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
106#endif /* TypeCheck */
107
108#if TypeCheck1
109 if (BAD_TYPECHECK(&In0P->object_sizeType, &object_sizeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->object_sizeType); _c.t =
*(&object_sizeCheck);_t.w != _c.w; })), 0)
)
110 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
111#endif /* TypeCheck */
112
113 OutP->RetCode = S_default_pager_object_create(In0P->Head.msgh_request_portmsgh_local_port, &OutP->memory_object, &memory_objectPoly, In0P->object_size);
114 if (OutP->RetCode != KERN_SUCCESS0)
115 return;
116
117 msgh_simple = TRUE((boolean_t) 1);
118 OutP->Head.msgh_size = 40;
119
120 OutP->memory_objectType = memory_objectType;
121
122 if (MACH_MSG_TYPE_PORT_ANY(memory_objectPoly)(((memory_objectPoly) >= 16) && ((memory_objectPoly
) <= 21))
)
123 msgh_simple = FALSE((boolean_t) 0);
124
125 OutP->memory_objectType.msgt_name = memory_objectPoly;
126
127 if (!msgh_simple)
128 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
129}
130
131/* Default implementation of S_default_pager_object_create */
132#ifdef MIG_EOPNOTSUPP
133kern_return_t __attribute__ ((weak))
134S_default_pager_object_create
135(
136 mach_port_t default_pager,
137 memory_object_t *memory_object,
138 mach_msg_type_name_t *memory_objectPoly,
139 vm_size_t object_size
140) { return MIG_EOPNOTSUPP; }
141#endif /* MIG_EOPNOTSUPP */
142
143/* Routine default_pager_info */
144mig_internalstatic void _Xdefault_pager_info
145 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
146{
147 typedef struct {
148 mach_msg_header_t Head;
149 } Request;
150
151 typedef struct {
152 mach_msg_header_t Head;
153 mach_msg_type_t RetCodeType;
154 kern_return_t RetCode;
155 mach_msg_type_t infoType;
156 default_pager_info_t info;
157 } Reply;
158
159 Request *In0P = (Request *) InHeadP;
160 Reply *OutP = (Reply *) OutHeadP;
161 mig_external kern_return_t S_default_pager_info
162 (mach_port_t default_pager, default_pager_info_t *info);
163
164 const mach_msg_type_t infoType = {
165 /* msgt_name = */ 2,
166 /* msgt_size = */ 32,
167 /* msgt_number = */ 3,
168 /* msgt_inline = */ TRUE((boolean_t) 1),
169 /* msgt_longform = */ FALSE((boolean_t) 0),
170 /* msgt_deallocate = */ FALSE((boolean_t) 0),
171 /* msgt_unused = */ 0
172 };
173
174#if TypeCheck1
175 if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
176 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
177 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
178#endif /* TypeCheck */
179
180 OutP->RetCode = S_default_pager_info(In0P->Head.msgh_request_portmsgh_local_port, &OutP->info);
181 if (OutP->RetCode != KERN_SUCCESS0)
182 return;
183
184 OutP->Head.msgh_size = 48;
185
186 OutP->infoType = infoType;
187}
188
189/* Default implementation of S_default_pager_info */
190#ifdef MIG_EOPNOTSUPP
191kern_return_t __attribute__ ((weak))
192S_default_pager_info
193(
194 mach_port_t default_pager,
195 default_pager_info_t *info
196) { return MIG_EOPNOTSUPP; }
197#endif /* MIG_EOPNOTSUPP */
198
199/* Routine default_pager_objects */
200mig_internalstatic void _Xdefault_pager_objects
201 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
202{
203 typedef struct {
204 mach_msg_header_t Head;
205 mach_msg_type_t objectsCntType;
206 mach_msg_type_number_t objectsCnt;
207 mach_msg_type_t portsCntType;
208 mach_msg_type_number_t portsCnt;
209 } Request;
210
211 typedef struct {
212 mach_msg_header_t Head;
213 mach_msg_type_t RetCodeType;
214 kern_return_t RetCode;
215 mach_msg_type_long_t objectsType;
216 default_pager_object_t objects[256];
217 mach_msg_type_long_t portsType;
218 mach_port_t ports[512];
219 } Reply;
220
221 Request *In0P = (Request *) InHeadP;
222 Reply *OutP = (Reply *) OutHeadP;
223 mig_external kern_return_t S_default_pager_objects
224 (mach_port_t default_pager, default_pager_object_array_t *objects, mach_msg_type_number_t *objectsCnt, mach_port_array_t *ports, mach_msg_type_number_t *portsCnt);
225
226 unsigned int msgh_size;
227 unsigned int msgh_size_delta;
228
229 const mach_msg_type_t objectsCntCheck = {
230 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
231 /* msgt_size = */ 32,
232 /* msgt_number = */ 1,
233 /* msgt_inline = */ TRUE((boolean_t) 1),
234 /* msgt_longform = */ FALSE((boolean_t) 0),
235 /* msgt_deallocate = */ FALSE((boolean_t) 0),
236 /* msgt_unused = */ 0
237 };
238
239 const mach_msg_type_t portsCntCheck = {
240 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
241 /* msgt_size = */ 32,
242 /* msgt_number = */ 1,
243 /* msgt_inline = */ TRUE((boolean_t) 1),
244 /* msgt_longform = */ FALSE((boolean_t) 0),
245 /* msgt_deallocate = */ FALSE((boolean_t) 0),
246 /* msgt_unused = */ 0
247 };
248
249 const mach_msg_type_long_t objectsType = {
250 {
251 /* msgt_name = */ 0,
252 /* msgt_size = */ 0,
253 /* msgt_number = */ 0,
254 /* msgt_inline = */ TRUE((boolean_t) 1),
255 /* msgt_longform = */ TRUE((boolean_t) 1),
256 /* msgt_deallocate = */ FALSE((boolean_t) 0),
257 /* msgt_unused = */ 0
258 },
259 /* msgtl_name = */ 2,
260 /* msgtl_size = */ 32,
261 /* msgtl_number = */ 512,
262 };
263
264 const mach_msg_type_long_t portsType = {
265 {
266 /* msgt_name = */ 0,
267 /* msgt_size = */ 0,
268 /* msgt_number = */ 0,
269 /* msgt_inline = */ TRUE((boolean_t) 1),
270 /* msgt_longform = */ TRUE((boolean_t) 1),
271 /* msgt_deallocate = */ FALSE((boolean_t) 0),
272 /* msgt_unused = */ 0
273 },
274 /* msgtl_name = */ 17,
275 /* msgtl_size = */ 32,
276 /* msgtl_number = */ 512,
277 };
278
279 mach_msg_type_number_t objectsCnt;
280 mach_port_t ports[512];
281 mach_msg_type_number_t portsCnt;
282
283 default_pager_object_t *objectsP;
284 mach_port_t *portsP;
285
286#if TypeCheck1
287 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
288 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (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->objectsCntType, &objectsCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->objectsCntType); _c.t = *
(&objectsCntCheck);_t.w != _c.w; })), 0)
)
294 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
295#endif /* TypeCheck */
296
297#if TypeCheck1
298 if (BAD_TYPECHECK(&In0P->portsCntType, &portsCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->portsCntType); _c.t = *(
&portsCntCheck);_t.w != _c.w; })), 0)
)
299 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
300#endif /* TypeCheck */
301
302 objectsP = OutP->objects;
303 objectsCnt = 256;
304 if (In0P->objectsCnt < objectsCnt)
305 objectsCnt = In0P->objectsCnt;
306
307 portsP = ports;
308 portsCnt = 512;
309 if (In0P->portsCnt < portsCnt)
310 portsCnt = In0P->portsCnt;
311
312 OutP->RetCode = S_default_pager_objects(In0P->Head.msgh_request_portmsgh_local_port, &objectsP, &objectsCnt, &portsP, &portsCnt);
313 if (OutP->RetCode != KERN_SUCCESS0)
314 return;
315
316 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
317
318 OutP->objectsType = objectsType;
319 if (objectsP != OutP->objects) {
320 OutP->objectsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
321 OutP->objectsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
322 *((default_pager_object_t **)OutP->objects) = objectsP;
323 }
324
325 OutP->objectsType.msgtl_number = 2 * objectsCnt;
326 msgh_size_delta = (OutP->objectsType.msgtl_header.msgt_inline) ? 8 * objectsCnt : sizeof(default_pager_object_t *);
327 msgh_size = 56 + msgh_size_delta;
328 OutP = (Reply *) ((char *) OutP + msgh_size_delta - 2048);
329
330 OutP->portsType = portsType;
331
332 if (portsP != ports) {
333 OutP->portsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
334 OutP->portsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
335 *((mach_port_t **)OutP->ports) = portsP;
336 }
337 else {
338 memcpy(OutP->ports, ports, 4 * portsCnt);
339 }
340
341 OutP->portsType.msgtl_number = portsCnt;
342 msgh_size += (OutP->portsType.msgtl_header.msgt_inline) ? 4 * portsCnt : sizeof(mach_port_t *);
343
344 OutP = (Reply *) OutHeadP;
345 OutP->Head.msgh_size = msgh_size;
346}
347
348/* Default implementation of S_default_pager_objects */
349#ifdef MIG_EOPNOTSUPP
350kern_return_t __attribute__ ((weak))
351S_default_pager_objects
352(
353 mach_port_t default_pager,
354 default_pager_object_array_t *objects,
355 mach_msg_type_number_t *objectsCnt,
356 mach_port_array_t *ports,
357 mach_msg_type_number_t *portsCnt
358) { return MIG_EOPNOTSUPP; }
359#endif /* MIG_EOPNOTSUPP */
360
361/* Routine default_pager_object_pages */
362mig_internalstatic void _Xdefault_pager_object_pages
363 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
364{
365 typedef struct {
366 mach_msg_header_t Head;
367 mach_msg_type_t memory_objectType;
368 mach_port_t memory_object;
369 mach_msg_type_t pagesCntType;
370 mach_msg_type_number_t pagesCnt;
371 } Request;
372
373 typedef struct {
374 mach_msg_header_t Head;
375 mach_msg_type_t RetCodeType;
376 kern_return_t RetCode;
377 mach_msg_type_long_t pagesType;
378 default_pager_page_t pages[512];
379 } Reply;
380
381 Request *In0P = (Request *) InHeadP;
382 Reply *OutP = (Reply *) OutHeadP;
383 mig_external kern_return_t S_default_pager_object_pages
384 (mach_port_t default_pager, mach_port_t memory_object, default_pager_page_array_t *pages, mach_msg_type_number_t *pagesCnt);
385
386 boolean_t msgh_simple = msgh_simple;
Value stored to 'msgh_simple' during its initialization is never read
387 const mach_msg_type_t memory_objectCheck = {
388 /* msgt_name = */ 17,
389 /* msgt_size = */ 32,
390 /* msgt_number = */ 1,
391 /* msgt_inline = */ TRUE((boolean_t) 1),
392 /* msgt_longform = */ FALSE((boolean_t) 0),
393 /* msgt_deallocate = */ FALSE((boolean_t) 0),
394 /* msgt_unused = */ 0
395 };
396
397 const mach_msg_type_t pagesCntCheck = {
398 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
399 /* msgt_size = */ 32,
400 /* msgt_number = */ 1,
401 /* msgt_inline = */ TRUE((boolean_t) 1),
402 /* msgt_longform = */ FALSE((boolean_t) 0),
403 /* msgt_deallocate = */ FALSE((boolean_t) 0),
404 /* msgt_unused = */ 0
405 };
406
407 const mach_msg_type_long_t pagesType = {
408 {
409 /* msgt_name = */ 0,
410 /* msgt_size = */ 0,
411 /* msgt_number = */ 0,
412 /* msgt_inline = */ TRUE((boolean_t) 1),
413 /* msgt_longform = */ TRUE((boolean_t) 1),
414 /* msgt_deallocate = */ FALSE((boolean_t) 0),
415 /* msgt_unused = */ 0
416 },
417 /* msgtl_name = */ 2,
418 /* msgtl_size = */ 32,
419 /* msgtl_number = */ 512,
420 };
421
422 mach_msg_type_number_t pagesCnt;
423
424 default_pager_page_t *pagesP;
425
426#if TypeCheck1
427 if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
428 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
429 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
430#endif /* TypeCheck */
431
432#if TypeCheck1
433 if (BAD_TYPECHECK(&In0P->memory_objectType, &memory_objectCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->memory_objectType); _c.t
= *(&memory_objectCheck);_t.w != _c.w; })), 0)
)
434 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
435#endif /* TypeCheck */
436
437#if TypeCheck1
438 if (BAD_TYPECHECK(&In0P->pagesCntType, &pagesCntCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->pagesCntType); _c.t = *(
&pagesCntCheck);_t.w != _c.w; })), 0)
)
439 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
440#endif /* TypeCheck */
441
442 pagesP = OutP->pages;
443 pagesCnt = 512;
444 if (In0P->pagesCnt < pagesCnt)
445 pagesCnt = In0P->pagesCnt;
446
447 OutP->RetCode = S_default_pager_object_pages(In0P->Head.msgh_request_portmsgh_local_port, In0P->memory_object, &pagesP, &pagesCnt);
448 if (OutP->RetCode != KERN_SUCCESS0)
449 return;
450
451 msgh_simple = TRUE((boolean_t) 1);
452
453 OutP->pagesType = pagesType;
454 if (pagesP != OutP->pages) {
455 OutP->pagesType.msgtl_header.msgt_inline = FALSE((boolean_t) 0);
456 OutP->pagesType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1);
457 *((default_pager_page_t **)OutP->pages) = pagesP;
458 msgh_simple = FALSE((boolean_t) 0);
459 }
460
461 OutP->pagesType.msgtl_number = pagesCnt;
462 OutP->Head.msgh_size = 44 + ((OutP->pagesType.msgtl_header.msgt_inline) ? 4 * pagesCnt : sizeof(default_pager_page_t *));
463
464 if (!msgh_simple)
465 OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U;
466}
467
468/* Default implementation of S_default_pager_object_pages */
469#ifdef MIG_EOPNOTSUPP
470kern_return_t __attribute__ ((weak))
471S_default_pager_object_pages
472(
473 mach_port_t default_pager,
474 mach_port_t memory_object,
475 default_pager_page_array_t *pages,
476 mach_msg_type_number_t *pagesCnt
477) { return MIG_EOPNOTSUPP; }
478#endif /* MIG_EOPNOTSUPP */
479
480/* Routine default_pager_paging_file */
481mig_internalstatic void _Xdefault_pager_paging_file
482 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
483{
484 typedef struct {
485 mach_msg_header_t Head;
486 mach_msg_type_t master_device_portType;
487 mach_port_t master_device_port;
488 mach_msg_type_long_t filenameType;
489 default_pager_filename_t filename;
490 mach_msg_type_t addType;
491 boolean_t add;
492 } Request;
493
494 typedef struct {
495 mach_msg_header_t Head;
496 mach_msg_type_t RetCodeType;
497 kern_return_t RetCode;
498 } Reply;
499
500 Request *In0P = (Request *) InHeadP;
501 Reply *OutP = (Reply *) OutHeadP;
502 mig_external kern_return_t S_default_pager_paging_file
503 (mach_port_t default_pager, mach_port_t master_device_port, default_pager_filename_t filename, boolean_t add);
504
505 const mach_msg_type_t master_device_portCheck = {
506 /* msgt_name = */ 17,
507 /* msgt_size = */ 32,
508 /* msgt_number = */ 1,
509 /* msgt_inline = */ TRUE((boolean_t) 1),
510 /* msgt_longform = */ FALSE((boolean_t) 0),
511 /* msgt_deallocate = */ FALSE((boolean_t) 0),
512 /* msgt_unused = */ 0
513 };
514
515 const mach_msg_type_t addCheck = {
516 /* msgt_name = */ 0,
517 /* msgt_size = */ 32,
518 /* msgt_number = */ 1,
519 /* msgt_inline = */ TRUE((boolean_t) 1),
520 /* msgt_longform = */ FALSE((boolean_t) 0),
521 /* msgt_deallocate = */ FALSE((boolean_t) 0),
522 /* msgt_unused = */ 0
523 };
524
525#if TypeCheck1
526 if (mig_unlikely ((In0P->Head.msgh_size != 308) ||__builtin_expect (!! ((In0P->Head.msgh_size != 308) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
527 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 308) || !(In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
528 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
529#endif /* TypeCheck */
530
531#if TypeCheck1
532 if (BAD_TYPECHECK(&In0P->master_device_portType, &master_device_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->master_device_portType);
_c.t = *(&master_device_portCheck);_t.w != _c.w; })), 0)
)
533 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
534#endif /* TypeCheck */
535
536#if TypeCheck1
537 if (mig_unlikely ((In0P->filenameType.msgtl_header.msgt_inline != TRUE) ||__builtin_expect (!! ((In0P->filenameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_name != 12
) || (In0P->filenameType.msgtl_number != 1) || (In0P->filenameType
.msgtl_size != 2048)), 0)
538 (In0P->filenameType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->filenameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_name != 12
) || (In0P->filenameType.msgtl_number != 1) || (In0P->filenameType
.msgtl_size != 2048)), 0)
539 (In0P->filenameType.msgtl_name != 12) ||__builtin_expect (!! ((In0P->filenameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_name != 12
) || (In0P->filenameType.msgtl_number != 1) || (In0P->filenameType
.msgtl_size != 2048)), 0)
540 (In0P->filenameType.msgtl_number != 1) ||__builtin_expect (!! ((In0P->filenameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_name != 12
) || (In0P->filenameType.msgtl_number != 1) || (In0P->filenameType
.msgtl_size != 2048)), 0)
541 (In0P->filenameType.msgtl_size != 2048))__builtin_expect (!! ((In0P->filenameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->filenameType.msgtl_name != 12
) || (In0P->filenameType.msgtl_number != 1) || (In0P->filenameType
.msgtl_size != 2048)), 0)
)
542 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
543#endif /* TypeCheck */
544
545#if TypeCheck1
546 if (BAD_TYPECHECK(&In0P->addType, &addCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->addType); _c.t = *(&
addCheck);_t.w != _c.w; })), 0)
)
547 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
548#endif /* TypeCheck */
549
550 OutP->RetCode = S_default_pager_paging_file(In0P->Head.msgh_request_portmsgh_local_port, In0P->master_device_port, In0P->filename, In0P->add);
551}
552
553/* Default implementation of S_default_pager_paging_file */
554#ifdef MIG_EOPNOTSUPP
555kern_return_t __attribute__ ((weak))
556S_default_pager_paging_file
557(
558 mach_port_t default_pager,
559 mach_port_t master_device_port,
560 default_pager_filename_t filename,
561 boolean_t add
562) { return MIG_EOPNOTSUPP; }
563#endif /* MIG_EOPNOTSUPP */
564
565/* Routine default_pager_paging_storage */
566mig_internalstatic void _Xdefault_pager_paging_storage
567 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
568{
569 typedef struct {
570 mach_msg_header_t Head;
571 mach_msg_type_t device_portType;
572 mach_port_t device_port;
573 mach_msg_type_long_t runsType;
574 recnum_t runs[512];
575 mach_msg_type_long_t nameType;
576 default_pager_filename_t name;
577 mach_msg_type_t addType;
578 boolean_t add;
579 } Request;
580
581 typedef struct {
582 mach_msg_header_t Head;
583 mach_msg_type_t RetCodeType;
584 kern_return_t RetCode;
585 } Reply;
586
587 Request *In0P = (Request *) InHeadP;
588 Request *In1P;
589 Reply *OutP = (Reply *) OutHeadP;
590 mig_external kern_return_t S_default_pager_paging_storage
591 (mach_port_t default_pager, mach_port_t device_port, recnum_array_t runs, mach_msg_type_number_t runsCnt, default_pager_filename_t name, boolean_t add);
592
593 unsigned int msgh_size;
594 unsigned int msgh_size_delta;
595
596 const mach_msg_type_t device_portCheck = {
597 /* msgt_name = */ 17,
598 /* msgt_size = */ 32,
599 /* msgt_number = */ 1,
600 /* msgt_inline = */ TRUE((boolean_t) 1),
601 /* msgt_longform = */ FALSE((boolean_t) 0),
602 /* msgt_deallocate = */ FALSE((boolean_t) 0),
603 /* msgt_unused = */ 0
604 };
605
606 const mach_msg_type_t addCheck = {
607 /* msgt_name = */ 0,
608 /* msgt_size = */ 32,
609 /* msgt_number = */ 1,
610 /* msgt_inline = */ TRUE((boolean_t) 1),
611 /* msgt_longform = */ FALSE((boolean_t) 0),
612 /* msgt_deallocate = */ FALSE((boolean_t) 0),
613 /* msgt_unused = */ 0
614 };
615
616#if TypeCheck1
617 msgh_size = In0P->Head.msgh_size;
618 if (mig_unlikely ((msgh_size < 320) ||__builtin_expect (!! ((msgh_size < 320) || !(In0P->Head
.msgh_bits & 0x80000000U)), 0)
619 !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 320) || !(In0P->Head
.msgh_bits & 0x80000000U)), 0)
)
620 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
621#endif /* TypeCheck */
622
623#if TypeCheck1
624 if (BAD_TYPECHECK(&In0P->device_portType, &device_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->device_portType); _c.t =
*(&device_portCheck);_t.w != _c.w; })), 0)
)
625 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
626#endif /* TypeCheck */
627
628#if TypeCheck1
629 if (mig_unlikely ((In0P->runsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->runsType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->runsType.msgtl_name != 2) ||
(In0P->runsType.msgtl_size != 32)), 0)
630 (In0P->runsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->runsType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->runsType.msgtl_name != 2) ||
(In0P->runsType.msgtl_size != 32)), 0)
631 (In0P->runsType.msgtl_size != 32))__builtin_expect (!! ((In0P->runsType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In0P->runsType.msgtl_name != 2) ||
(In0P->runsType.msgtl_size != 32)), 0)
)
632 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
633#endif /* TypeCheck */
634
635 msgh_size_delta = (In0P->runsType.msgtl_header.msgt_inline) ? 4 * In0P->runsType.msgtl_number : sizeof(recnum_t *);
636#if TypeCheck1
637 if (mig_unlikely (msgh_size != 320 + msgh_size_delta)__builtin_expect (!! (msgh_size != 320 + msgh_size_delta), 0))
638 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
639#endif /* TypeCheck */
640
641 In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048);
642
643#if TypeCheck1
644 if (mig_unlikely ((In1P->nameType.msgtl_header.msgt_inline != TRUE) ||__builtin_expect (!! ((In1P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_name != 12) ||
(In1P->nameType.msgtl_number != 1) || (In1P->nameType.
msgtl_size != 2048)), 0)
645 (In1P->nameType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_name != 12) ||
(In1P->nameType.msgtl_number != 1) || (In1P->nameType.
msgtl_size != 2048)), 0)
646 (In1P->nameType.msgtl_name != 12) ||__builtin_expect (!! ((In1P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_name != 12) ||
(In1P->nameType.msgtl_number != 1) || (In1P->nameType.
msgtl_size != 2048)), 0)
647 (In1P->nameType.msgtl_number != 1) ||__builtin_expect (!! ((In1P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_name != 12) ||
(In1P->nameType.msgtl_number != 1) || (In1P->nameType.
msgtl_size != 2048)), 0)
648 (In1P->nameType.msgtl_size != 2048))__builtin_expect (!! ((In1P->nameType.msgtl_header.msgt_inline
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_header.msgt_longform
!= ((boolean_t) 1)) || (In1P->nameType.msgtl_name != 12) ||
(In1P->nameType.msgtl_number != 1) || (In1P->nameType.
msgtl_size != 2048)), 0)
)
649 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
650#endif /* TypeCheck */
651
652#if TypeCheck1
653 if (BAD_TYPECHECK(&In1P->addType, &addCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In1P->addType); _c.t = *(&
addCheck);_t.w != _c.w; })), 0)
)
654 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
655#endif /* TypeCheck */
656
657 OutP->RetCode = S_default_pager_paging_storage(In0P->Head.msgh_request_portmsgh_local_port, In0P->device_port, (In0P->runsType.msgtl_header.msgt_inline) ? In0P->runs : *((recnum_t **)In0P->runs), In0P->runsType.msgtl_number, In1P->name, In1P->add);
658 if (OutP->RetCode == KERN_SUCCESS0)
659 if (!In0P->runsType.msgtl_header.msgt_inline)
660 __mig_deallocate(* (vm_offset_t *) In0P->runs, 4 * In0P->runsType.msgtl_number);
661}
662
663/* Default implementation of S_default_pager_paging_storage */
664#ifdef MIG_EOPNOTSUPP
665kern_return_t __attribute__ ((weak))
666S_default_pager_paging_storage
667(
668 mach_port_t default_pager,
669 mach_port_t device_port,
670 recnum_array_t runs,
671 mach_msg_type_number_t runsCnt,
672 default_pager_filename_t name,
673 boolean_t add
674) { return MIG_EOPNOTSUPP; }
675#endif /* MIG_EOPNOTSUPP */
676
677/* Routine default_pager_object_set_size */
678mig_internalstatic void _Xdefault_pager_object_set_size
679 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
680{
681 typedef struct {
682 mach_msg_header_t Head;
683 mach_msg_type_t object_size_limitType;
684 vm_size_t object_size_limit;
685 } Request;
686
687 typedef struct {
688 mach_msg_header_t Head;
689 mach_msg_type_t RetCodeType;
690 kern_return_t RetCode;
691 } Reply;
692
693 Request *In0P = (Request *) InHeadP;
694 Reply *OutP = (Reply *) OutHeadP;
695 mig_external kern_return_t S_default_pager_object_set_size
696 (default_pager_t memory_object, mach_port_seqno_t seqno, vm_size_t object_size_limit);
697
698 const mach_msg_type_t object_size_limitCheck = {
699 /* msgt_name = */ 2,
700 /* msgt_size = */ 32,
701 /* msgt_number = */ 1,
702 /* msgt_inline = */ TRUE((boolean_t) 1),
703 /* msgt_longform = */ FALSE((boolean_t) 0),
704 /* msgt_deallocate = */ FALSE((boolean_t) 0),
705 /* msgt_unused = */ 0
706 };
707
708 default_pager_t memory_object;
709
710#if TypeCheck1
711 if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
712 (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P
->Head.msgh_bits & 0x80000000U)), 0)
)
713 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
714#endif /* TypeCheck */
715
716#if TypeCheck1
717 if (BAD_TYPECHECK(&In0P->object_size_limitType, &object_size_limitCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t
w; } _t, _c; _t.t = *(&In0P->object_size_limitType); _c
.t = *(&object_size_limitCheck);_t.w != _c.w; })), 0)
)
718 { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; }
719#endif /* TypeCheck */
720
721 if (MACH_MSGH_BITS_LOCAL (In0P->Head.msgh_bits)(((In0P->Head.msgh_bits) & 0x0000ff00) >> 8) == MACH_MSG_TYPE_PROTECTED_PAYLOAD23)
722 memory_object = begin_using_default_pager_payload(In0P->Head.msgh_protected_payload);
723 else
724 memory_object = begin_using_default_pager(In0P->Head.msgh_request_portmsgh_local_port);
725
726 OutP->RetCode = S_default_pager_object_set_size(memory_object, In0P->Head.msgh_seqno, In0P->object_size_limit);
727}
728
729/* Default implementation of S_default_pager_object_set_size */
730#ifdef MIG_EOPNOTSUPP
731kern_return_t __attribute__ ((weak))
732S_default_pager_object_set_size
733(
734 default_pager_t memory_object,
735 mach_port_seqno_t seqno,
736 vm_size_t object_size_limit
737) { return MIG_EOPNOTSUPP; }
738#endif /* MIG_EOPNOTSUPP */
739
740mig_routine_t default_pager_server_routines[] = {
741 _Xdefault_pager_object_create,
742 _Xdefault_pager_info,
743 _Xdefault_pager_objects,
744 _Xdefault_pager_object_pages,
745 _Xdefault_pager_paging_file,
746 0,
747 _Xdefault_pager_paging_storage,
748 _Xdefault_pager_object_set_size,
749};
750
751mig_external boolean_t default_pager_server
752 (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP)
753{
754 mach_msg_header_t *InP = InHeadP;
755 mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP;
756
757 const mach_msg_type_t RetCodeType = {
758 /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322,
759 /* msgt_size = */ 32,
760 /* msgt_number = */ 1,
761 /* msgt_inline = */ TRUE((boolean_t) 1),
762 /* msgt_longform = */ FALSE((boolean_t) 0),
763 /* msgt_deallocate = */ FALSE((boolean_t) 0),
764 /* msgt_unused = */ 0
765 };
766
767 mig_routine_t routine;
768
769 OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8));
770 OutP->Head.msgh_size = sizeof *OutP;
771 OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port;
772 OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0);
773 OutP->Head.msgh_seqno = 0;
774 OutP->Head.msgh_id = InP->msgh_id + 100;
775
776 OutP->RetCodeType = RetCodeType;
777
778 if ((InP->msgh_id > 2282) || (InP->msgh_id < 2275) ||
779 ((routine = default_pager_server_routines[InP->msgh_id - 2275]) == 0)) {
780 OutP->RetCode = MIG_BAD_ID-303;
781 return FALSE((boolean_t) 0);
782 }
783 (*routine) (InP, &OutP->Head);
784 return TRUE((boolean_t) 1);
785}
786
787mig_external mig_routine_t default_pager_server_routine
788 (const mach_msg_header_t *InHeadP)
789{
790 int msgh_id;
791
792 msgh_id = InHeadP->msgh_id - 2275;
793
794 if ((msgh_id > 7) || (msgh_id < 0))
795 return 0;
796
797 return default_pager_server_routines[msgh_id];
798}
799