File: | obj-scan-build/trans/fsysServer.c |
Location: | line 428, column 12 |
Description: | Value stored to 'msgh_simple' during its initialization is never read |
1 | /* Module fsys */ |
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 fsys_startup */ |
54 | mig_internalstatic void _Xfsys_startup |
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 openflagsType; |
60 | int openflags; |
61 | mach_msg_type_t control_portType; |
62 | mach_port_t control_port; |
63 | } Request; |
64 | |
65 | typedef struct { |
66 | mach_msg_header_t Head; |
67 | mach_msg_type_t RetCodeType; |
68 | kern_return_t RetCode; |
69 | mach_msg_type_t realnodeType; |
70 | mach_port_t realnode; |
71 | } Reply; |
72 | |
73 | Request *In0P = (Request *) InHeadP; |
74 | Reply *OutP = (Reply *) OutHeadP; |
75 | mig_external kern_return_t S_fsys_startup |
76 | (mach_port_t bootstrap, int openflags, mach_port_t control_port, mach_port_t *realnode, mach_msg_type_name_t *realnodePoly); |
77 | |
78 | boolean_t msgh_simple = msgh_simple; |
79 | const mach_msg_type_t openflagsCheck = { |
80 | /* msgt_name = */ 2, |
81 | /* msgt_size = */ 32, |
82 | /* msgt_number = */ 1, |
83 | /* msgt_inline = */ TRUE((boolean_t) 1), |
84 | /* msgt_longform = */ FALSE((boolean_t) 0), |
85 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
86 | /* msgt_unused = */ 0 |
87 | }; |
88 | |
89 | const mach_msg_type_t control_portCheck = { |
90 | /* msgt_name = */ 17, |
91 | /* msgt_size = */ 32, |
92 | /* msgt_number = */ 1, |
93 | /* msgt_inline = */ TRUE((boolean_t) 1), |
94 | /* msgt_longform = */ FALSE((boolean_t) 0), |
95 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
96 | /* msgt_unused = */ 0 |
97 | }; |
98 | |
99 | const mach_msg_type_t realnodeType = { |
100 | /* msgt_name = */ -1, |
101 | /* msgt_size = */ 32, |
102 | /* msgt_number = */ 1, |
103 | /* msgt_inline = */ TRUE((boolean_t) 1), |
104 | /* msgt_longform = */ FALSE((boolean_t) 0), |
105 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
106 | /* msgt_unused = */ 0 |
107 | }; |
108 | |
109 | mach_msg_type_name_t realnodePoly; |
110 | |
111 | #if TypeCheck1 |
112 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
113 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
114 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
115 | #endif /* TypeCheck */ |
116 | |
117 | #if TypeCheck1 |
118 | if (BAD_TYPECHECK(&In0P->openflagsType, &openflagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->openflagsType); _c.t = * (&openflagsCheck);_t.w != _c.w; })), 0)) |
119 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
120 | #endif /* TypeCheck */ |
121 | |
122 | #if TypeCheck1 |
123 | if (BAD_TYPECHECK(&In0P->control_portType, &control_portCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->control_portType); _c.t = *(&control_portCheck);_t.w != _c.w; })), 0)) |
124 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
125 | #endif /* TypeCheck */ |
126 | |
127 | OutP->RetCode = S_fsys_startup(In0P->Head.msgh_request_portmsgh_local_port, In0P->openflags, In0P->control_port, &OutP->realnode, &realnodePoly); |
128 | if (OutP->RetCode != KERN_SUCCESS0) |
129 | return; |
130 | |
131 | msgh_simple = TRUE((boolean_t) 1); |
132 | OutP->Head.msgh_size = 40; |
133 | |
134 | OutP->realnodeType = realnodeType; |
135 | |
136 | if (MACH_MSG_TYPE_PORT_ANY(realnodePoly)(((realnodePoly) >= 16) && ((realnodePoly) <= 21 ))) |
137 | msgh_simple = FALSE((boolean_t) 0); |
138 | |
139 | OutP->realnodeType.msgt_name = realnodePoly; |
140 | |
141 | if (!msgh_simple) |
142 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
143 | } |
144 | |
145 | /* Default implementation of S_fsys_startup */ |
146 | #ifdef MIG_EOPNOTSUPP |
147 | kern_return_t __attribute__ ((weak)) |
148 | S_fsys_startup |
149 | ( |
150 | mach_port_t bootstrap, |
151 | int openflags, |
152 | mach_port_t control_port, |
153 | mach_port_t *realnode, |
154 | mach_msg_type_name_t *realnodePoly |
155 | ) { return MIG_EOPNOTSUPP; } |
156 | #endif /* MIG_EOPNOTSUPP */ |
157 | |
158 | /* Routine fsys_goaway */ |
159 | mig_internalstatic void _Xfsys_goaway |
160 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
161 | { |
162 | typedef struct { |
163 | mach_msg_header_t Head; |
164 | mach_msg_type_t flagsType; |
165 | int flags; |
166 | } Request; |
167 | |
168 | typedef struct { |
169 | mach_msg_header_t Head; |
170 | mach_msg_type_t RetCodeType; |
171 | kern_return_t RetCode; |
172 | } Reply; |
173 | |
174 | Request *In0P = (Request *) InHeadP; |
175 | Reply *OutP = (Reply *) OutHeadP; |
176 | mig_external kern_return_t S_fsys_goaway |
177 | (fsys_t fsys, int flags); |
178 | |
179 | const mach_msg_type_t flagsCheck = { |
180 | /* msgt_name = */ 2, |
181 | /* msgt_size = */ 32, |
182 | /* msgt_number = */ 1, |
183 | /* msgt_inline = */ TRUE((boolean_t) 1), |
184 | /* msgt_longform = */ FALSE((boolean_t) 0), |
185 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
186 | /* msgt_unused = */ 0 |
187 | }; |
188 | |
189 | #if TypeCheck1 |
190 | if (mig_unlikely ((In0P->Head.msgh_size != 32) ||__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
191 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 32) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
192 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
193 | #endif /* TypeCheck */ |
194 | |
195 | #if TypeCheck1 |
196 | if (BAD_TYPECHECK(&In0P->flagsType, &flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->flagsType); _c.t = *(& flagsCheck);_t.w != _c.w; })), 0)) |
197 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
198 | #endif /* TypeCheck */ |
199 | |
200 | OutP->RetCode = S_fsys_goaway(In0P->Head.msgh_request_portmsgh_local_port, In0P->flags); |
201 | } |
202 | |
203 | /* Default implementation of S_fsys_goaway */ |
204 | #ifdef MIG_EOPNOTSUPP |
205 | kern_return_t __attribute__ ((weak)) |
206 | S_fsys_goaway |
207 | ( |
208 | fsys_t fsys, |
209 | int flags |
210 | ) { return MIG_EOPNOTSUPP; } |
211 | #endif /* MIG_EOPNOTSUPP */ |
212 | |
213 | /* Routine fsys_getroot */ |
214 | mig_internalstatic void _Xfsys_getroot |
215 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
216 | { |
217 | typedef struct { |
218 | mach_msg_header_t Head; |
219 | mach_msg_type_t dotdot_nodeType; |
220 | mach_port_t dotdot_node; |
221 | mach_msg_type_long_t gen_uidsType; |
222 | uid_t gen_uids[512]; |
223 | mach_msg_type_long_t gen_gidsType; |
224 | uid_t gen_gids[512]; |
225 | mach_msg_type_t flagsType; |
226 | int flags; |
227 | } Request; |
228 | |
229 | typedef struct { |
230 | mach_msg_header_t Head; |
231 | mach_msg_type_t RetCodeType; |
232 | kern_return_t RetCode; |
233 | mach_msg_type_t do_retryType; |
234 | retry_type do_retry; |
235 | mach_msg_type_t retry_nameType; |
236 | string_t retry_name; |
237 | mach_msg_type_t fileType; |
238 | mach_port_t file; |
239 | } Reply; |
240 | |
241 | Request *In0P = (Request *) InHeadP; |
242 | Request *In1P; |
243 | Request *In2P; |
244 | Reply *OutP = (Reply *) OutHeadP; |
245 | mig_external kern_return_t S_fsys_getroot |
246 | (fsys_t fsys, mach_port_t dotdot_node, idarray_t gen_uids, mach_msg_type_number_t gen_uidsCnt, idarray_t gen_gids, mach_msg_type_number_t gen_gidsCnt, int flags, retry_type *do_retry, string_t retry_name, mach_port_t *file, mach_msg_type_name_t *filePoly); |
247 | |
248 | boolean_t msgh_simple = msgh_simple; |
249 | unsigned int msgh_size; |
250 | unsigned int msgh_size_delta; |
251 | |
252 | const mach_msg_type_t dotdot_nodeCheck = { |
253 | /* msgt_name = */ 17, |
254 | /* msgt_size = */ 32, |
255 | /* msgt_number = */ 1, |
256 | /* msgt_inline = */ TRUE((boolean_t) 1), |
257 | /* msgt_longform = */ FALSE((boolean_t) 0), |
258 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
259 | /* msgt_unused = */ 0 |
260 | }; |
261 | |
262 | const mach_msg_type_t flagsCheck = { |
263 | /* msgt_name = */ 2, |
264 | /* msgt_size = */ 32, |
265 | /* msgt_number = */ 1, |
266 | /* msgt_inline = */ TRUE((boolean_t) 1), |
267 | /* msgt_longform = */ FALSE((boolean_t) 0), |
268 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
269 | /* msgt_unused = */ 0 |
270 | }; |
271 | |
272 | const mach_msg_type_t do_retryType = { |
273 | /* msgt_name = */ 2, |
274 | /* msgt_size = */ 32, |
275 | /* msgt_number = */ 1, |
276 | /* msgt_inline = */ TRUE((boolean_t) 1), |
277 | /* msgt_longform = */ FALSE((boolean_t) 0), |
278 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
279 | /* msgt_unused = */ 0 |
280 | }; |
281 | |
282 | const mach_msg_type_t retry_nameType = { |
283 | /* msgt_name = */ MACH_MSG_TYPE_STRING_C12, |
284 | /* msgt_size = */ 8, |
285 | /* msgt_number = */ 1024, |
286 | /* msgt_inline = */ TRUE((boolean_t) 1), |
287 | /* msgt_longform = */ FALSE((boolean_t) 0), |
288 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
289 | /* msgt_unused = */ 0 |
290 | }; |
291 | |
292 | const mach_msg_type_t fileType = { |
293 | /* msgt_name = */ -1, |
294 | /* msgt_size = */ 32, |
295 | /* msgt_number = */ 1, |
296 | /* msgt_inline = */ TRUE((boolean_t) 1), |
297 | /* msgt_longform = */ FALSE((boolean_t) 0), |
298 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
299 | /* msgt_unused = */ 0 |
300 | }; |
301 | |
302 | mach_msg_type_name_t filePoly; |
303 | |
304 | #if TypeCheck1 |
305 | msgh_size = In0P->Head.msgh_size; |
306 | if (mig_unlikely ((msgh_size < 64) ||__builtin_expect (!! ((msgh_size < 64) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
307 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 64) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
308 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
309 | #endif /* TypeCheck */ |
310 | |
311 | #if TypeCheck1 |
312 | if (BAD_TYPECHECK(&In0P->dotdot_nodeType, &dotdot_nodeCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->dotdot_nodeType); _c.t = *(&dotdot_nodeCheck);_t.w != _c.w; })), 0)) |
313 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
314 | #endif /* TypeCheck */ |
315 | |
316 | #if TypeCheck1 |
317 | if (mig_unlikely ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
318 | (In0P->gen_uidsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
319 | (In0P->gen_uidsType.msgtl_size != 32))__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0)) |
320 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
321 | #endif /* TypeCheck */ |
322 | |
323 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
324 | #if TypeCheck1 |
325 | if (mig_unlikely (msgh_size < 64 + msgh_size_delta)__builtin_expect (!! (msgh_size < 64 + msgh_size_delta), 0 )) |
326 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
327 | msgh_size -= msgh_size_delta; |
328 | #endif /* TypeCheck */ |
329 | |
330 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
331 | |
332 | #if TypeCheck1 |
333 | if (mig_unlikely ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
334 | (In1P->gen_gidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
335 | (In1P->gen_gidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0)) |
336 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
337 | #endif /* TypeCheck */ |
338 | |
339 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
340 | #if TypeCheck1 |
341 | if (mig_unlikely (msgh_size != 64 + msgh_size_delta)__builtin_expect (!! (msgh_size != 64 + msgh_size_delta), 0)) |
342 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
343 | #endif /* TypeCheck */ |
344 | |
345 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
346 | |
347 | #if TypeCheck1 |
348 | if (BAD_TYPECHECK(&In2P->flagsType, &flagsCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In2P->flagsType); _c.t = *(& flagsCheck);_t.w != _c.w; })), 0)) |
349 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
350 | #endif /* TypeCheck */ |
351 | |
352 | OutP->RetCode = S_fsys_getroot(In0P->Head.msgh_request_portmsgh_local_port, In0P->dotdot_node, (In0P->gen_uidsType.msgtl_header.msgt_inline) ? In0P->gen_uids : *((uid_t **)In0P->gen_uids), In0P->gen_uidsType.msgtl_number, (In1P->gen_gidsType.msgtl_header.msgt_inline) ? In1P->gen_gids : *((uid_t **)In1P->gen_gids), In1P->gen_gidsType.msgtl_number, In2P->flags, &OutP->do_retry, OutP->retry_name, &OutP->file, &filePoly); |
353 | if (OutP->RetCode == KERN_SUCCESS0) |
354 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
355 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
356 | if (OutP->RetCode == KERN_SUCCESS0) |
357 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
358 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
359 | if (OutP->RetCode != KERN_SUCCESS0) |
360 | return; |
361 | |
362 | msgh_simple = TRUE((boolean_t) 1); |
363 | OutP->Head.msgh_size = 1076; |
364 | |
365 | OutP->do_retryType = do_retryType; |
366 | |
367 | OutP->retry_nameType = retry_nameType; |
368 | |
369 | OutP->fileType = fileType; |
370 | |
371 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
372 | msgh_simple = FALSE((boolean_t) 0); |
373 | |
374 | OutP->fileType.msgt_name = filePoly; |
375 | |
376 | if (!msgh_simple) |
377 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
378 | } |
379 | |
380 | /* Default implementation of S_fsys_getroot */ |
381 | #ifdef MIG_EOPNOTSUPP |
382 | kern_return_t __attribute__ ((weak)) |
383 | S_fsys_getroot |
384 | ( |
385 | fsys_t fsys, |
386 | mach_port_t dotdot_node, |
387 | idarray_t gen_uids, |
388 | mach_msg_type_number_t gen_uidsCnt, |
389 | idarray_t gen_gids, |
390 | mach_msg_type_number_t gen_gidsCnt, |
391 | int flags, |
392 | retry_type *do_retry, |
393 | string_t retry_name, |
394 | mach_port_t *file, |
395 | mach_msg_type_name_t *filePoly |
396 | ) { return MIG_EOPNOTSUPP; } |
397 | #endif /* MIG_EOPNOTSUPP */ |
398 | |
399 | /* Routine fsys_getfile */ |
400 | mig_internalstatic void _Xfsys_getfile |
401 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
402 | { |
403 | typedef struct { |
404 | mach_msg_header_t Head; |
405 | mach_msg_type_long_t gen_uidsType; |
406 | uid_t gen_uids[512]; |
407 | mach_msg_type_long_t gen_gidsType; |
408 | uid_t gen_gids[512]; |
409 | mach_msg_type_long_t filehandleType; |
410 | char filehandle[2048]; |
411 | } Request; |
412 | |
413 | typedef struct { |
414 | mach_msg_header_t Head; |
415 | mach_msg_type_t RetCodeType; |
416 | kern_return_t RetCode; |
417 | mach_msg_type_t fileType; |
418 | mach_port_t file; |
419 | } Reply; |
420 | |
421 | Request *In0P = (Request *) InHeadP; |
422 | Request *In1P; |
423 | Request *In2P; |
424 | Reply *OutP = (Reply *) OutHeadP; |
425 | mig_external kern_return_t S_fsys_getfile |
426 | (fsys_t fsys, idarray_t gen_uids, mach_msg_type_number_t gen_uidsCnt, idarray_t gen_gids, mach_msg_type_number_t gen_gidsCnt, data_t filehandle, mach_msg_type_number_t filehandleCnt, mach_port_t *file, mach_msg_type_name_t *filePoly); |
427 | |
428 | boolean_t msgh_simple = msgh_simple; |
Value stored to 'msgh_simple' during its initialization is never read | |
429 | unsigned int msgh_size; |
430 | unsigned int msgh_size_delta; |
431 | |
432 | const mach_msg_type_t fileType = { |
433 | /* msgt_name = */ -1, |
434 | /* msgt_size = */ 32, |
435 | /* msgt_number = */ 1, |
436 | /* msgt_inline = */ TRUE((boolean_t) 1), |
437 | /* msgt_longform = */ FALSE((boolean_t) 0), |
438 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
439 | /* msgt_unused = */ 0 |
440 | }; |
441 | |
442 | mach_msg_type_name_t filePoly; |
443 | |
444 | #if TypeCheck1 |
445 | msgh_size = In0P->Head.msgh_size; |
446 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
447 | if (mig_unlikely ((msgh_size < 60))__builtin_expect (!! ((msgh_size < 60)), 0)) |
448 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
449 | #endif /* TypeCheck */ |
450 | |
451 | #if TypeCheck1 |
452 | if (mig_unlikely ((In0P->gen_uidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
453 | (In0P->gen_uidsType.msgtl_name != 2) ||__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0) |
454 | (In0P->gen_uidsType.msgtl_size != 32))__builtin_expect (!! ((In0P->gen_uidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->gen_uidsType.msgtl_name != 2 ) || (In0P->gen_uidsType.msgtl_size != 32)), 0)) |
455 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
456 | #endif /* TypeCheck */ |
457 | |
458 | msgh_size_delta = (In0P->gen_uidsType.msgtl_header.msgt_inline) ? 4 * In0P->gen_uidsType.msgtl_number : sizeof(uid_t *); |
459 | #if TypeCheck1 |
460 | if (mig_unlikely (msgh_size < 60 + msgh_size_delta)__builtin_expect (!! (msgh_size < 60 + msgh_size_delta), 0 )) |
461 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
462 | msgh_size -= msgh_size_delta; |
463 | #endif /* TypeCheck */ |
464 | |
465 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
466 | |
467 | #if TypeCheck1 |
468 | if (mig_unlikely ((In1P->gen_gidsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
469 | (In1P->gen_gidsType.msgtl_name != 2) ||__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0) |
470 | (In1P->gen_gidsType.msgtl_size != 32))__builtin_expect (!! ((In1P->gen_gidsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In1P->gen_gidsType.msgtl_name != 2 ) || (In1P->gen_gidsType.msgtl_size != 32)), 0)) |
471 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
472 | #endif /* TypeCheck */ |
473 | |
474 | msgh_size_delta = (In1P->gen_gidsType.msgtl_header.msgt_inline) ? 4 * In1P->gen_gidsType.msgtl_number : sizeof(uid_t *); |
475 | #if TypeCheck1 |
476 | if (mig_unlikely (msgh_size < 60 + msgh_size_delta)__builtin_expect (!! (msgh_size < 60 + msgh_size_delta), 0 )) |
477 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
478 | msgh_size -= msgh_size_delta; |
479 | #endif /* TypeCheck */ |
480 | |
481 | In2P = (Request *) ((char *) In1P + msgh_size_delta - 2048); |
482 | |
483 | #if TypeCheck1 |
484 | if (mig_unlikely ((In2P->filehandleType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0) |
485 | (In2P->filehandleType.msgtl_name != 8) ||__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0) |
486 | (In2P->filehandleType.msgtl_size != 8))__builtin_expect (!! ((In2P->filehandleType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In2P->filehandleType.msgtl_name != 8) || (In2P->filehandleType.msgtl_size != 8)), 0)) |
487 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
488 | #endif /* TypeCheck */ |
489 | |
490 | #if TypeCheck1 |
491 | if (mig_unlikely (msgh_size != 60 + ((In2P->filehandleType.msgtl_header.msgt_inline) ? (In2P->filehandleType.msgtl_number + 3) & ~3 : sizeof(char *)))__builtin_expect (!! (msgh_size != 60 + ((In2P->filehandleType .msgtl_header.msgt_inline) ? (In2P->filehandleType.msgtl_number + 3) & ~3 : sizeof(char *))), 0)) |
492 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
493 | #endif /* TypeCheck */ |
494 | |
495 | OutP->RetCode = S_fsys_getfile(In0P->Head.msgh_request_portmsgh_local_port, (In0P->gen_uidsType.msgtl_header.msgt_inline) ? In0P->gen_uids : *((uid_t **)In0P->gen_uids), In0P->gen_uidsType.msgtl_number, (In1P->gen_gidsType.msgtl_header.msgt_inline) ? In1P->gen_gids : *((uid_t **)In1P->gen_gids), In1P->gen_gidsType.msgtl_number, (In2P->filehandleType.msgtl_header.msgt_inline) ? In2P->filehandle : *((char **)In2P->filehandle), In2P->filehandleType.msgtl_number, &OutP->file, &filePoly); |
496 | if (OutP->RetCode == KERN_SUCCESS0) |
497 | if (!In2P->filehandleType.msgtl_header.msgt_inline) |
498 | __mig_deallocate(* (vm_offset_t *) In2P->filehandle, In2P->filehandleType.msgtl_number); |
499 | if (OutP->RetCode == KERN_SUCCESS0) |
500 | if (!In1P->gen_gidsType.msgtl_header.msgt_inline) |
501 | __mig_deallocate(* (vm_offset_t *) In1P->gen_gids, 4 * In1P->gen_gidsType.msgtl_number); |
502 | if (OutP->RetCode == KERN_SUCCESS0) |
503 | if (!In0P->gen_uidsType.msgtl_header.msgt_inline) |
504 | __mig_deallocate(* (vm_offset_t *) In0P->gen_uids, 4 * In0P->gen_uidsType.msgtl_number); |
505 | if (OutP->RetCode != KERN_SUCCESS0) |
506 | return; |
507 | |
508 | msgh_simple = TRUE((boolean_t) 1); |
509 | OutP->Head.msgh_size = 40; |
510 | |
511 | OutP->fileType = fileType; |
512 | |
513 | if (MACH_MSG_TYPE_PORT_ANY(filePoly)(((filePoly) >= 16) && ((filePoly) <= 21))) |
514 | msgh_simple = FALSE((boolean_t) 0); |
515 | |
516 | OutP->fileType.msgt_name = filePoly; |
517 | |
518 | if (!msgh_simple) |
519 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
520 | } |
521 | |
522 | /* Default implementation of S_fsys_getfile */ |
523 | #ifdef MIG_EOPNOTSUPP |
524 | kern_return_t __attribute__ ((weak)) |
525 | S_fsys_getfile |
526 | ( |
527 | fsys_t fsys, |
528 | idarray_t gen_uids, |
529 | mach_msg_type_number_t gen_uidsCnt, |
530 | idarray_t gen_gids, |
531 | mach_msg_type_number_t gen_gidsCnt, |
532 | data_t filehandle, |
533 | mach_msg_type_number_t filehandleCnt, |
534 | mach_port_t *file, |
535 | mach_msg_type_name_t *filePoly |
536 | ) { return MIG_EOPNOTSUPP; } |
537 | #endif /* MIG_EOPNOTSUPP */ |
538 | |
539 | /* Routine fsys_syncfs */ |
540 | mig_internalstatic void _Xfsys_syncfs |
541 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
542 | { |
543 | typedef struct { |
544 | mach_msg_header_t Head; |
545 | mach_msg_type_t waitType; |
546 | int wait; |
547 | mach_msg_type_t do_childrenType; |
548 | int do_children; |
549 | } Request; |
550 | |
551 | typedef struct { |
552 | mach_msg_header_t Head; |
553 | mach_msg_type_t RetCodeType; |
554 | kern_return_t RetCode; |
555 | } Reply; |
556 | |
557 | Request *In0P = (Request *) InHeadP; |
558 | Reply *OutP = (Reply *) OutHeadP; |
559 | mig_external kern_return_t S_fsys_syncfs |
560 | (fsys_t fsys, int wait, int do_children); |
561 | |
562 | const mach_msg_type_t waitCheck = { |
563 | /* msgt_name = */ 2, |
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 | const mach_msg_type_t do_childrenCheck = { |
573 | /* msgt_name = */ 2, |
574 | /* msgt_size = */ 32, |
575 | /* msgt_number = */ 1, |
576 | /* msgt_inline = */ TRUE((boolean_t) 1), |
577 | /* msgt_longform = */ FALSE((boolean_t) 0), |
578 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
579 | /* msgt_unused = */ 0 |
580 | }; |
581 | |
582 | #if TypeCheck1 |
583 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
584 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
585 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
586 | #endif /* TypeCheck */ |
587 | |
588 | #if TypeCheck1 |
589 | if (BAD_TYPECHECK(&In0P->waitType, &waitCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->waitType); _c.t = *(& waitCheck);_t.w != _c.w; })), 0)) |
590 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
591 | #endif /* TypeCheck */ |
592 | |
593 | #if TypeCheck1 |
594 | if (BAD_TYPECHECK(&In0P->do_childrenType, &do_childrenCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->do_childrenType); _c.t = *(&do_childrenCheck);_t.w != _c.w; })), 0)) |
595 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
596 | #endif /* TypeCheck */ |
597 | |
598 | OutP->RetCode = S_fsys_syncfs(In0P->Head.msgh_request_portmsgh_local_port, In0P->wait, In0P->do_children); |
599 | } |
600 | |
601 | /* Default implementation of S_fsys_syncfs */ |
602 | #ifdef MIG_EOPNOTSUPP |
603 | kern_return_t __attribute__ ((weak)) |
604 | S_fsys_syncfs |
605 | ( |
606 | fsys_t fsys, |
607 | int wait, |
608 | int do_children |
609 | ) { return MIG_EOPNOTSUPP; } |
610 | #endif /* MIG_EOPNOTSUPP */ |
611 | |
612 | /* Routine fsys_set_options */ |
613 | mig_internalstatic void _Xfsys_set_options |
614 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
615 | { |
616 | typedef struct { |
617 | mach_msg_header_t Head; |
618 | mach_msg_type_long_t optionsType; |
619 | char options[2048]; |
620 | mach_msg_type_t do_childrenType; |
621 | int do_children; |
622 | } Request; |
623 | |
624 | typedef struct { |
625 | mach_msg_header_t Head; |
626 | mach_msg_type_t RetCodeType; |
627 | kern_return_t RetCode; |
628 | } Reply; |
629 | |
630 | Request *In0P = (Request *) InHeadP; |
631 | Request *In1P; |
632 | Reply *OutP = (Reply *) OutHeadP; |
633 | mig_external kern_return_t S_fsys_set_options |
634 | (fsys_t fsys, data_t options, mach_msg_type_number_t optionsCnt, int do_children); |
635 | |
636 | #if TypeCheck1 |
637 | boolean_t msgh_simple = msgh_simple; |
638 | #endif /* TypeCheck */ |
639 | |
640 | unsigned int msgh_size; |
641 | unsigned int msgh_size_delta; |
642 | |
643 | const mach_msg_type_t do_childrenCheck = { |
644 | /* msgt_name = */ 2, |
645 | /* msgt_size = */ 32, |
646 | /* msgt_number = */ 1, |
647 | /* msgt_inline = */ TRUE((boolean_t) 1), |
648 | /* msgt_longform = */ FALSE((boolean_t) 0), |
649 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
650 | /* msgt_unused = */ 0 |
651 | }; |
652 | |
653 | #if TypeCheck1 |
654 | msgh_size = In0P->Head.msgh_size; |
655 | msgh_simple = !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX0x80000000U); |
656 | if (mig_unlikely ((msgh_size < 44))__builtin_expect (!! ((msgh_size < 44)), 0)) |
657 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
658 | #endif /* TypeCheck */ |
659 | |
660 | #if TypeCheck1 |
661 | if (mig_unlikely ((In0P->optionsType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0) |
662 | (In0P->optionsType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0) |
663 | (In0P->optionsType.msgtl_size != 8))__builtin_expect (!! ((In0P->optionsType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->optionsType.msgtl_name != 8 ) || (In0P->optionsType.msgtl_size != 8)), 0)) |
664 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
665 | #endif /* TypeCheck */ |
666 | |
667 | msgh_size_delta = (In0P->optionsType.msgtl_header.msgt_inline) ? (In0P->optionsType.msgtl_number + 3) & ~3 : sizeof(char *); |
668 | #if TypeCheck1 |
669 | if (mig_unlikely (msgh_size != 44 + msgh_size_delta)__builtin_expect (!! (msgh_size != 44 + msgh_size_delta), 0)) |
670 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
671 | #endif /* TypeCheck */ |
672 | |
673 | In1P = (Request *) ((char *) In0P + msgh_size_delta - 2048); |
674 | |
675 | #if TypeCheck1 |
676 | if (BAD_TYPECHECK(&In1P->do_childrenType, &do_childrenCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In1P->do_childrenType); _c.t = *(&do_childrenCheck);_t.w != _c.w; })), 0)) |
677 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
678 | #endif /* TypeCheck */ |
679 | |
680 | OutP->RetCode = S_fsys_set_options(In0P->Head.msgh_request_portmsgh_local_port, (In0P->optionsType.msgtl_header.msgt_inline) ? In0P->options : *((char **)In0P->options), In0P->optionsType.msgtl_number, In1P->do_children); |
681 | if (OutP->RetCode == KERN_SUCCESS0) |
682 | if (!In0P->optionsType.msgtl_header.msgt_inline) |
683 | __mig_deallocate(* (vm_offset_t *) In0P->options, In0P->optionsType.msgtl_number); |
684 | } |
685 | |
686 | /* Default implementation of S_fsys_set_options */ |
687 | #ifdef MIG_EOPNOTSUPP |
688 | kern_return_t __attribute__ ((weak)) |
689 | S_fsys_set_options |
690 | ( |
691 | fsys_t fsys, |
692 | data_t options, |
693 | mach_msg_type_number_t optionsCnt, |
694 | int do_children |
695 | ) { return MIG_EOPNOTSUPP; } |
696 | #endif /* MIG_EOPNOTSUPP */ |
697 | |
698 | /* Routine fsys_getpriv */ |
699 | mig_internalstatic void _Xfsys_getpriv |
700 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
701 | { |
702 | typedef struct { |
703 | mach_msg_header_t Head; |
704 | } Request; |
705 | |
706 | typedef struct { |
707 | mach_msg_header_t Head; |
708 | mach_msg_type_t RetCodeType; |
709 | kern_return_t RetCode; |
710 | mach_msg_type_t host_privType; |
711 | mach_port_t host_priv; |
712 | mach_msg_type_t device_masterType; |
713 | mach_port_t device_master; |
714 | mach_msg_type_t fstaskType; |
715 | mach_port_t fstask; |
716 | } Reply; |
717 | |
718 | Request *In0P = (Request *) InHeadP; |
719 | Reply *OutP = (Reply *) OutHeadP; |
720 | mig_external kern_return_t S_fsys_getpriv |
721 | (fsys_t fsys, mach_port_t *host_priv, mach_msg_type_name_t *host_privPoly, mach_port_t *device_master, mach_msg_type_name_t *device_masterPoly, mach_port_t *fstask, mach_msg_type_name_t *fstaskPoly); |
722 | |
723 | boolean_t msgh_simple = msgh_simple; |
724 | const mach_msg_type_t host_privType = { |
725 | /* msgt_name = */ -1, |
726 | /* msgt_size = */ 32, |
727 | /* msgt_number = */ 1, |
728 | /* msgt_inline = */ TRUE((boolean_t) 1), |
729 | /* msgt_longform = */ FALSE((boolean_t) 0), |
730 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
731 | /* msgt_unused = */ 0 |
732 | }; |
733 | |
734 | const mach_msg_type_t device_masterType = { |
735 | /* msgt_name = */ -1, |
736 | /* msgt_size = */ 32, |
737 | /* msgt_number = */ 1, |
738 | /* msgt_inline = */ TRUE((boolean_t) 1), |
739 | /* msgt_longform = */ FALSE((boolean_t) 0), |
740 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
741 | /* msgt_unused = */ 0 |
742 | }; |
743 | |
744 | const mach_msg_type_t fstaskType = { |
745 | /* msgt_name = */ -1, |
746 | /* msgt_size = */ 32, |
747 | /* msgt_number = */ 1, |
748 | /* msgt_inline = */ TRUE((boolean_t) 1), |
749 | /* msgt_longform = */ FALSE((boolean_t) 0), |
750 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
751 | /* msgt_unused = */ 0 |
752 | }; |
753 | |
754 | mach_msg_type_name_t host_privPoly; |
755 | mach_msg_type_name_t device_masterPoly; |
756 | mach_msg_type_name_t fstaskPoly; |
757 | |
758 | #if TypeCheck1 |
759 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
760 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
761 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
762 | #endif /* TypeCheck */ |
763 | |
764 | OutP->RetCode = S_fsys_getpriv(In0P->Head.msgh_request_portmsgh_local_port, &OutP->host_priv, &host_privPoly, &OutP->device_master, &device_masterPoly, &OutP->fstask, &fstaskPoly); |
765 | if (OutP->RetCode != KERN_SUCCESS0) |
766 | return; |
767 | |
768 | msgh_simple = TRUE((boolean_t) 1); |
769 | OutP->Head.msgh_size = 56; |
770 | |
771 | OutP->host_privType = host_privType; |
772 | |
773 | if (MACH_MSG_TYPE_PORT_ANY(host_privPoly)(((host_privPoly) >= 16) && ((host_privPoly) <= 21))) |
774 | msgh_simple = FALSE((boolean_t) 0); |
775 | |
776 | OutP->host_privType.msgt_name = host_privPoly; |
777 | |
778 | OutP->device_masterType = device_masterType; |
779 | |
780 | if (MACH_MSG_TYPE_PORT_ANY(device_masterPoly)(((device_masterPoly) >= 16) && ((device_masterPoly ) <= 21))) |
781 | msgh_simple = FALSE((boolean_t) 0); |
782 | |
783 | OutP->device_masterType.msgt_name = device_masterPoly; |
784 | |
785 | OutP->fstaskType = fstaskType; |
786 | |
787 | if (MACH_MSG_TYPE_PORT_ANY(fstaskPoly)(((fstaskPoly) >= 16) && ((fstaskPoly) <= 21))) |
788 | msgh_simple = FALSE((boolean_t) 0); |
789 | |
790 | OutP->fstaskType.msgt_name = fstaskPoly; |
791 | |
792 | if (!msgh_simple) |
793 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
794 | } |
795 | |
796 | /* Default implementation of S_fsys_getpriv */ |
797 | #ifdef MIG_EOPNOTSUPP |
798 | kern_return_t __attribute__ ((weak)) |
799 | S_fsys_getpriv |
800 | ( |
801 | fsys_t fsys, |
802 | mach_port_t *host_priv, |
803 | mach_msg_type_name_t *host_privPoly, |
804 | mach_port_t *device_master, |
805 | mach_msg_type_name_t *device_masterPoly, |
806 | mach_port_t *fstask, |
807 | mach_msg_type_name_t *fstaskPoly |
808 | ) { return MIG_EOPNOTSUPP; } |
809 | #endif /* MIG_EOPNOTSUPP */ |
810 | |
811 | /* Routine fsys_init */ |
812 | mig_internalstatic void _Xfsys_init |
813 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
814 | { |
815 | typedef struct { |
816 | mach_msg_header_t Head; |
817 | mach_msg_type_t proc_serverType; |
818 | mach_port_t proc_server; |
819 | mach_msg_type_t auth_handleType; |
820 | auth_t auth_handle; |
821 | } Request; |
822 | |
823 | typedef struct { |
824 | mach_msg_header_t Head; |
825 | mach_msg_type_t RetCodeType; |
826 | kern_return_t RetCode; |
827 | } Reply; |
828 | |
829 | Request *In0P = (Request *) InHeadP; |
830 | Reply *OutP = (Reply *) OutHeadP; |
831 | mig_external kern_return_t S_fsys_init |
832 | (fsys_t fsys, mach_port_t reply_port, mach_msg_type_name_t reply_portPoly, mach_port_t proc_server, auth_t auth_handle); |
833 | |
834 | const mach_msg_type_t proc_serverCheck = { |
835 | /* msgt_name = */ 17, |
836 | /* msgt_size = */ 32, |
837 | /* msgt_number = */ 1, |
838 | /* msgt_inline = */ TRUE((boolean_t) 1), |
839 | /* msgt_longform = */ FALSE((boolean_t) 0), |
840 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
841 | /* msgt_unused = */ 0 |
842 | }; |
843 | |
844 | const mach_msg_type_t auth_handleCheck = { |
845 | /* msgt_name = */ 17, |
846 | /* msgt_size = */ 32, |
847 | /* msgt_number = */ 1, |
848 | /* msgt_inline = */ TRUE((boolean_t) 1), |
849 | /* msgt_longform = */ FALSE((boolean_t) 0), |
850 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
851 | /* msgt_unused = */ 0 |
852 | }; |
853 | |
854 | #if TypeCheck1 |
855 | if (mig_unlikely ((In0P->Head.msgh_size != 40) ||__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0) |
856 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 40) || !(In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
857 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
858 | #endif /* TypeCheck */ |
859 | |
860 | #if TypeCheck1 |
861 | if (BAD_TYPECHECK(&In0P->proc_serverType, &proc_serverCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->proc_serverType); _c.t = *(&proc_serverCheck);_t.w != _c.w; })), 0)) |
862 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
863 | #endif /* TypeCheck */ |
864 | |
865 | #if TypeCheck1 |
866 | if (BAD_TYPECHECK(&In0P->auth_handleType, &auth_handleCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->auth_handleType); _c.t = *(&auth_handleCheck);_t.w != _c.w; })), 0)) |
867 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
868 | #endif /* TypeCheck */ |
869 | |
870 | OutP->RetCode = S_fsys_init(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->proc_server, In0P->auth_handle); |
871 | } |
872 | |
873 | /* Default implementation of S_fsys_init */ |
874 | #ifdef MIG_EOPNOTSUPP |
875 | kern_return_t __attribute__ ((weak)) |
876 | S_fsys_init |
877 | ( |
878 | fsys_t fsys, |
879 | mach_port_t reply_port, |
880 | mach_msg_type_name_t reply_portPoly, |
881 | mach_port_t proc_server, |
882 | auth_t auth_handle |
883 | ) { return MIG_EOPNOTSUPP; } |
884 | #endif /* MIG_EOPNOTSUPP */ |
885 | |
886 | /* Routine fsys_forward */ |
887 | mig_internalstatic void _Xfsys_forward |
888 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
889 | { |
890 | typedef struct { |
891 | mach_msg_header_t Head; |
892 | mach_msg_type_t requestorType; |
893 | mach_port_t requestor; |
894 | mach_msg_type_long_t argvType; |
895 | char argv[2048]; |
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_fsys_forward |
907 | (mach_port_t server, mach_port_t requestor, data_t argv, mach_msg_type_number_t argvCnt); |
908 | |
909 | unsigned int msgh_size; |
910 | |
911 | const mach_msg_type_t requestorCheck = { |
912 | /* msgt_name = */ 17, |
913 | /* msgt_size = */ 32, |
914 | /* msgt_number = */ 1, |
915 | /* msgt_inline = */ TRUE((boolean_t) 1), |
916 | /* msgt_longform = */ FALSE((boolean_t) 0), |
917 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
918 | /* msgt_unused = */ 0 |
919 | }; |
920 | |
921 | #if TypeCheck1 |
922 | msgh_size = In0P->Head.msgh_size; |
923 | if (mig_unlikely ((msgh_size < 44) ||__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0) |
924 | !(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((msgh_size < 44) || !(In0P->Head. msgh_bits & 0x80000000U)), 0)) |
925 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
926 | #endif /* TypeCheck */ |
927 | |
928 | #if TypeCheck1 |
929 | if (BAD_TYPECHECK(&In0P->requestorType, &requestorCheck)__builtin_expect (!! (({ union { mach_msg_type_t t; unsigned32_t w; } _t, _c; _t.t = *(&In0P->requestorType); _c.t = * (&requestorCheck);_t.w != _c.w; })), 0)) |
930 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
931 | #endif /* TypeCheck */ |
932 | |
933 | #if TypeCheck1 |
934 | if (mig_unlikely ((In0P->argvType.msgtl_header.msgt_longform != TRUE) ||__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0) |
935 | (In0P->argvType.msgtl_name != 8) ||__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0) |
936 | (In0P->argvType.msgtl_size != 8))__builtin_expect (!! ((In0P->argvType.msgtl_header.msgt_longform != ((boolean_t) 1)) || (In0P->argvType.msgtl_name != 8) || (In0P->argvType.msgtl_size != 8)), 0)) |
937 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
938 | #endif /* TypeCheck */ |
939 | |
940 | #if TypeCheck1 |
941 | if (mig_unlikely (msgh_size != 44 + ((In0P->argvType.msgtl_header.msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *)))__builtin_expect (!! (msgh_size != 44 + ((In0P->argvType.msgtl_header .msgt_inline) ? (In0P->argvType.msgtl_number + 3) & ~3 : sizeof(char *))), 0)) |
942 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
943 | #endif /* TypeCheck */ |
944 | |
945 | OutP->RetCode = S_fsys_forward(In0P->Head.msgh_request_portmsgh_local_port, In0P->requestor, (In0P->argvType.msgtl_header.msgt_inline) ? In0P->argv : *((char **)In0P->argv), In0P->argvType.msgtl_number); |
946 | if (OutP->RetCode == KERN_SUCCESS0) |
947 | if (!In0P->argvType.msgtl_header.msgt_inline) |
948 | __mig_deallocate(* (vm_offset_t *) In0P->argv, In0P->argvType.msgtl_number); |
949 | } |
950 | |
951 | /* Default implementation of S_fsys_forward */ |
952 | #ifdef MIG_EOPNOTSUPP |
953 | kern_return_t __attribute__ ((weak)) |
954 | S_fsys_forward |
955 | ( |
956 | mach_port_t server, |
957 | mach_port_t requestor, |
958 | data_t argv, |
959 | mach_msg_type_number_t argvCnt |
960 | ) { return MIG_EOPNOTSUPP; } |
961 | #endif /* MIG_EOPNOTSUPP */ |
962 | |
963 | /* Routine fsys_get_options */ |
964 | mig_internalstatic void _Xfsys_get_options |
965 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
966 | { |
967 | typedef struct { |
968 | mach_msg_header_t Head; |
969 | } Request; |
970 | |
971 | typedef struct { |
972 | mach_msg_header_t Head; |
973 | mach_msg_type_t RetCodeType; |
974 | kern_return_t RetCode; |
975 | mach_msg_type_long_t optionsType; |
976 | char options[2048]; |
977 | } Reply; |
978 | |
979 | Request *In0P = (Request *) InHeadP; |
980 | Reply *OutP = (Reply *) OutHeadP; |
981 | mig_external kern_return_t S_fsys_get_options |
982 | (fsys_t server, data_t *options, mach_msg_type_number_t *optionsCnt); |
983 | |
984 | boolean_t msgh_simple = msgh_simple; |
985 | const mach_msg_type_long_t optionsType = { |
986 | { |
987 | /* msgt_name = */ 0, |
988 | /* msgt_size = */ 0, |
989 | /* msgt_number = */ 0, |
990 | /* msgt_inline = */ TRUE((boolean_t) 1), |
991 | /* msgt_longform = */ TRUE((boolean_t) 1), |
992 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
993 | /* msgt_unused = */ 0 |
994 | }, |
995 | /* msgtl_name = */ 8, |
996 | /* msgtl_size = */ 8, |
997 | /* msgtl_number = */ 2048, |
998 | }; |
999 | |
1000 | mach_msg_type_number_t optionsCnt; |
1001 | |
1002 | char *optionsP; |
1003 | |
1004 | #if TypeCheck1 |
1005 | if (mig_unlikely ((In0P->Head.msgh_size != 24) ||__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0) |
1006 | (In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX))__builtin_expect (!! ((In0P->Head.msgh_size != 24) || (In0P ->Head.msgh_bits & 0x80000000U)), 0)) |
1007 | { OutP->RetCode = MIG_BAD_ARGUMENTS-304; return; } |
1008 | #endif /* TypeCheck */ |
1009 | |
1010 | optionsP = OutP->options; |
1011 | optionsCnt = 2048; |
1012 | |
1013 | OutP->RetCode = S_fsys_get_options(In0P->Head.msgh_request_portmsgh_local_port, &optionsP, &optionsCnt); |
1014 | if (OutP->RetCode != KERN_SUCCESS0) |
1015 | return; |
1016 | |
1017 | msgh_simple = TRUE((boolean_t) 1); |
1018 | |
1019 | OutP->optionsType = optionsType; |
1020 | if (optionsP != OutP->options) { |
1021 | OutP->optionsType.msgtl_header.msgt_inline = FALSE((boolean_t) 0); |
1022 | OutP->optionsType.msgtl_header.msgt_deallocate = TRUE((boolean_t) 1); |
1023 | *((char **)OutP->options) = optionsP; |
1024 | msgh_simple = FALSE((boolean_t) 0); |
1025 | } |
1026 | |
1027 | OutP->optionsType.msgtl_number = optionsCnt; |
1028 | OutP->Head.msgh_size = 44 + ((OutP->optionsType.msgtl_header.msgt_inline) ? (optionsCnt + 3) & ~3 : sizeof(char *)); |
1029 | |
1030 | if (!msgh_simple) |
1031 | OutP->Head.msgh_bits |= MACH_MSGH_BITS_COMPLEX0x80000000U; |
1032 | } |
1033 | |
1034 | /* Default implementation of S_fsys_get_options */ |
1035 | #ifdef MIG_EOPNOTSUPP |
1036 | kern_return_t __attribute__ ((weak)) |
1037 | S_fsys_get_options |
1038 | ( |
1039 | fsys_t server, |
1040 | data_t *options, |
1041 | mach_msg_type_number_t *optionsCnt |
1042 | ) { return MIG_EOPNOTSUPP; } |
1043 | #endif /* MIG_EOPNOTSUPP */ |
1044 | |
1045 | mig_routine_t fsys_server_routines[] = { |
1046 | _Xfsys_startup, |
1047 | _Xfsys_goaway, |
1048 | _Xfsys_getroot, |
1049 | _Xfsys_getfile, |
1050 | _Xfsys_syncfs, |
1051 | _Xfsys_set_options, |
1052 | _Xfsys_getpriv, |
1053 | _Xfsys_init, |
1054 | _Xfsys_forward, |
1055 | _Xfsys_get_options, |
1056 | 0, |
1057 | 0, |
1058 | }; |
1059 | |
1060 | mig_external boolean_t fsys_server |
1061 | (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) |
1062 | { |
1063 | mach_msg_header_t *InP = InHeadP; |
1064 | mig_reply_header_t *OutP = (mig_reply_header_t *) OutHeadP; |
1065 | |
1066 | const mach_msg_type_t RetCodeType = { |
1067 | /* msgt_name = */ MACH_MSG_TYPE_INTEGER_322, |
1068 | /* msgt_size = */ 32, |
1069 | /* msgt_number = */ 1, |
1070 | /* msgt_inline = */ TRUE((boolean_t) 1), |
1071 | /* msgt_longform = */ FALSE((boolean_t) 0), |
1072 | /* msgt_deallocate = */ FALSE((boolean_t) 0), |
1073 | /* msgt_unused = */ 0 |
1074 | }; |
1075 | |
1076 | mig_routine_t routine; |
1077 | |
1078 | OutP->Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InP->msgh_bits), 0)((((InP->msgh_bits) & 0x000000ff)) | ((0) << 8)); |
1079 | OutP->Head.msgh_size = sizeof *OutP; |
1080 | OutP->Head.msgh_remote_port = InP->msgh_reply_portmsgh_remote_port; |
1081 | OutP->Head.msgh_local_port = MACH_PORT_NULL((mach_port_t) 0); |
1082 | OutP->Head.msgh_seqno = 0; |
1083 | OutP->Head.msgh_id = InP->msgh_id + 100; |
1084 | |
1085 | OutP->RetCodeType = RetCodeType; |
1086 | |
1087 | if ((InP->msgh_id > 22011) || (InP->msgh_id < 22000) || |
1088 | ((routine = fsys_server_routines[InP->msgh_id - 22000]) == 0)) { |
1089 | OutP->RetCode = MIG_BAD_ID-303; |
1090 | return FALSE((boolean_t) 0); |
1091 | } |
1092 | (*routine) (InP, &OutP->Head); |
1093 | return TRUE((boolean_t) 1); |
1094 | } |
1095 | |
1096 | mig_external mig_routine_t fsys_server_routine |
1097 | (const mach_msg_header_t *InHeadP) |
1098 | { |
1099 | int msgh_id; |
1100 | |
1101 | msgh_id = InHeadP->msgh_id - 22000; |
1102 | |
1103 | if ((msgh_id > 11) || (msgh_id < 0)) |
1104 | return 0; |
1105 | |
1106 | return fsys_server_routines[msgh_id]; |
1107 | } |
1108 |