Bug Summary

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