]> git.saurik.com Git - apple/libc.git/blob - mach/mach_msg.c
ac5b433a0fc24800b8033156e4173a8d9021e57e
[apple/libc.git] / mach / mach_msg.c
1 /*
2 * Copyright (c) 1999-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Mach Operating System
24 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
25 * All Rights Reserved.
26 *
27 * Permission to use, copy, modify and distribute this software and its
28 * documentation is hereby granted, provided that both the copyright
29 * notice and this permission notice appear in all copies of the
30 * software, derivative works or modified versions, and any portions
31 * thereof, and that both notices appear in supporting documentation.
32 *
33 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
34 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
35 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
36 *
37 * Carnegie Mellon requests users of this software to return to
38 *
39 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
40 * School of Computer Science
41 * Carnegie Mellon University
42 * Pittsburgh PA 15213-3890
43 *
44 * any improvements or extensions that they make and grant Carnegie Mellon
45 * the rights to redistribute these changes.
46 */
47
48 #include <stdlib.h>
49 #include <mach/mach.h>
50 #include <mach/boolean.h>
51 #include <mach/kern_return.h>
52 #include <mach/message.h>
53 #include <mach/mig_errors.h>
54 #include <mach/vm_statistics.h>
55
56 #ifdef HOST_MACH_MSG_TRAP
57 __private_extern__ kern_return_t _host_mach_msg_trap_return_ = KERN_FAILURE;
58
59 #define MACH_MSG_TRAP(msg, opt, ssize, rsize, rname, to, not) \
60 ((_host_mach_msg_trap_return_ == KERN_SUCCESS) ? \
61 mach_msg_trap((msg), (opt), (ssize), (rsize), (rname), (to), (not)) : \
62 mach_msg_overwrite_trap((msg), (opt), (ssize), (rsize), (rname), \
63 (to), (not), MACH_MSG_NULL, 0))
64
65 #else
66
67 #define MACH_MSG_TRAP(msg, opt, ssize, rsize, rname, to, not) \
68 mach_msg_overwrite_trap((msg), (opt), (ssize), (rsize), (rname), \
69 (to), (not), MACH_MSG_NULL, 0))
70 #endif
71
72 #define LIBMACH_OPTIONS (MACH_SEND_INTERRUPT|MACH_RCV_INTERRUPT)
73
74 /*
75 * Routine: mach_msg
76 * Purpose:
77 * Send and/or receive a message. If the message operation
78 * is interrupted, and the user did not request an indication
79 * of that fact, then restart the appropriate parts of the
80 * operation.
81 */
82 mach_msg_return_t
83 mach_msg(msg, option, send_size, rcv_size, rcv_name, timeout, notify)
84 mach_msg_header_t *msg;
85 mach_msg_option_t option;
86 mach_msg_size_t send_size;
87 mach_msg_size_t rcv_size;
88 mach_port_t rcv_name;
89 mach_msg_timeout_t timeout;
90 mach_port_t notify;
91 {
92 mach_msg_return_t mr;
93
94 /*
95 * Consider the following cases:
96 * 1) Errors in pseudo-receive (eg, MACH_SEND_INTERRUPTED
97 * plus special bits).
98 * 2) Use of MACH_SEND_INTERRUPT/MACH_RCV_INTERRUPT options.
99 * 3) RPC calls with interruptions in one/both halves.
100 *
101 * We refrain from passing the option bits that we implement
102 * to the kernel. This prevents their presence from inhibiting
103 * the kernel's fast paths (when it checks the option value).
104 */
105
106 mr = MACH_MSG_TRAP(msg, option &~ LIBMACH_OPTIONS,
107 send_size, rcv_size, rcv_name,
108 timeout, notify);
109 if (mr == MACH_MSG_SUCCESS)
110 return MACH_MSG_SUCCESS;
111
112 if ((option & MACH_SEND_INTERRUPT) == 0)
113 while (mr == MACH_SEND_INTERRUPTED)
114 mr = MACH_MSG_TRAP(msg,
115 option &~ LIBMACH_OPTIONS,
116 send_size, rcv_size, rcv_name,
117 timeout, notify);
118
119 if ((option & MACH_RCV_INTERRUPT) == 0)
120 while (mr == MACH_RCV_INTERRUPTED)
121 mr = MACH_MSG_TRAP(msg,
122 option &~ (LIBMACH_OPTIONS|MACH_SEND_MSG),
123 0, rcv_size, rcv_name,
124 timeout, notify);
125
126 return mr;
127 }
128
129 /*
130 * Routine: mach_msg_overwrite
131 * Purpose:
132 * Send and/or receive a message. If the message operation
133 * is interrupted, and the user did not request an indication
134 * of that fact, then restart the appropriate parts of the
135 * operation.
136 *
137 * Distinct send and receive buffers may be specified. If
138 * no separate receive buffer is specified, the msg parameter
139 * will be used for both send and receive operations.
140 *
141 * In addition to a distinct receive buffer, that buffer may
142 * already contain scatter control information to direct the
143 * receiving of the message.
144 */
145 mach_msg_return_t
146 mach_msg_overwrite(msg, option, send_size, rcv_limit, rcv_name, timeout,
147 notify, rcv_msg, rcv_scatter_size)
148 mach_msg_header_t *msg;
149 mach_msg_option_t option;
150 mach_msg_size_t send_size;
151 mach_msg_size_t rcv_limit;
152 mach_port_t rcv_name;
153 mach_msg_timeout_t timeout;
154 mach_port_t notify;
155 mach_msg_header_t *rcv_msg;
156 mach_msg_size_t rcv_scatter_size;
157 {
158 mach_msg_return_t mr;
159
160 /*
161 * Consider the following cases:
162 * 1) Errors in pseudo-receive (eg, MACH_SEND_INTERRUPTED
163 * plus special bits).
164 * 2) Use of MACH_SEND_INTERRUPT/MACH_RCV_INTERRUPT options.
165 * 3) RPC calls with interruptions in one/both halves.
166 *
167 * We refrain from passing the option bits that we implement
168 * to the kernel. This prevents their presence from inhibiting
169 * the kernel's fast paths (when it checks the option value).
170 */
171
172 mr = mach_msg_overwrite_trap(msg, option &~ LIBMACH_OPTIONS,
173 send_size, rcv_limit, rcv_name,
174 timeout, notify, rcv_msg, rcv_scatter_size);
175 if (mr == MACH_MSG_SUCCESS)
176 return MACH_MSG_SUCCESS;
177
178 if ((option & MACH_SEND_INTERRUPT) == 0)
179 while (mr == MACH_SEND_INTERRUPTED)
180 mr = mach_msg_overwrite_trap(msg,
181 option &~ LIBMACH_OPTIONS,
182 send_size, rcv_limit, rcv_name,
183 timeout, notify, rcv_msg, rcv_scatter_size);
184
185 if ((option & MACH_RCV_INTERRUPT) == 0)
186 while (mr == MACH_RCV_INTERRUPTED)
187 mr = mach_msg_overwrite_trap(msg,
188 option &~ (LIBMACH_OPTIONS|MACH_SEND_MSG),
189 0, rcv_limit, rcv_name,
190 timeout, notify, rcv_msg, rcv_scatter_size);
191
192 return mr;
193 }
194
195
196 mach_msg_return_t
197 mach_msg_send(mach_msg_header_t *msg)
198 {
199 return mach_msg(msg, MACH_SEND_MSG,
200 msg->msgh_size, 0, MACH_PORT_NULL,
201 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
202 }
203
204 mach_msg_return_t
205 mach_msg_receive(mach_msg_header_t *msg)
206 {
207 return mach_msg(msg, MACH_RCV_MSG,
208 0, msg->msgh_size, msg->msgh_local_port,
209 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
210 }
211
212
213 static void
214 mach_msg_destroy_port(mach_port_t port, mach_msg_type_name_t type)
215 {
216 if (MACH_PORT_VALID(port)) switch (type) {
217 case MACH_MSG_TYPE_MOVE_SEND:
218 case MACH_MSG_TYPE_MOVE_SEND_ONCE:
219 /* destroy the send/send-once right */
220 (void) mach_port_deallocate(mach_task_self(), port);
221 break;
222
223 case MACH_MSG_TYPE_MOVE_RECEIVE:
224 /* destroy the receive right */
225 (void) mach_port_mod_refs(mach_task_self(), port,
226 MACH_PORT_RIGHT_RECEIVE, -1);
227 break;
228
229 case MACH_MSG_TYPE_MAKE_SEND:
230 /* create a send right and then destroy it */
231 (void) mach_port_insert_right(mach_task_self(), port,
232 port, MACH_MSG_TYPE_MAKE_SEND);
233 (void) mach_port_deallocate(mach_task_self(), port);
234 break;
235
236 case MACH_MSG_TYPE_MAKE_SEND_ONCE:
237 /* create a send-once right and then destroy it */
238 (void) mach_port_extract_right(mach_task_self(), port,
239 MACH_MSG_TYPE_MAKE_SEND_ONCE,
240 &port, &type);
241 (void) mach_port_deallocate(mach_task_self(), port);
242 break;
243 }
244 }
245
246 static void
247 mach_msg_destroy_memory(vm_offset_t addr, vm_size_t size)
248 {
249 if (size != 0)
250 (void) vm_deallocate(mach_task_self(), addr, size);
251 }
252
253
254 /*
255 * Routine: mach_msg_destroy
256 * Purpose:
257 * mach_msg_destroy is useful in two contexts.
258 *
259 * First, it can deallocate all port rights and
260 * out-of-line memory in a received message.
261 * When a server receives a request it doesn't want,
262 * it needs this functionality.
263 *
264 * Second, it can mimic the side-effects of a msg-send
265 * operation. The effect is as if the message were sent
266 * and then destroyed inside the kernel. When a server
267 * can't send a reply (because the client died),
268 * it needs this functionality.
269 */
270 void
271 mach_msg_destroy(mach_msg_header_t *msg)
272 {
273 mach_msg_bits_t mbits = msg->msgh_bits;
274
275 /*
276 * The msgh_local_port field doesn't hold a port right.
277 * The receive operation consumes the destination port right.
278 */
279
280 mach_msg_destroy_port(msg->msgh_remote_port, MACH_MSGH_BITS_REMOTE(mbits));
281
282 if (mbits & MACH_MSGH_BITS_COMPLEX) {
283 mach_msg_body_t *body;
284 mach_msg_descriptor_t *saddr, *eaddr;
285
286 body = (mach_msg_body_t *) (msg + 1);
287 saddr = (mach_msg_descriptor_t *)
288 ((mach_msg_base_t *) msg + 1);
289 eaddr = saddr + body->msgh_descriptor_count;
290
291 for ( ; saddr < eaddr; saddr++) {
292 switch (saddr->type.type) {
293
294 case MACH_MSG_PORT_DESCRIPTOR: {
295 mach_msg_port_descriptor_t *dsc;
296
297 /*
298 * Destroy port rights carried in the message
299 */
300 dsc = &saddr->port;
301 mach_msg_destroy_port(dsc->name, dsc->disposition);
302 break;
303 }
304
305 case MACH_MSG_OOL_DESCRIPTOR : {
306 mach_msg_ool_descriptor_t *dsc;
307
308 /*
309 * Destroy memory carried in the message
310 */
311 dsc = &saddr->out_of_line;
312 if (dsc->deallocate) {
313 mach_msg_destroy_memory((vm_offset_t)dsc->address,
314 dsc->size);
315 }
316 break;
317 }
318
319 case MACH_MSG_OOL_PORTS_DESCRIPTOR : {
320 mach_port_t *ports;
321 mach_msg_ool_ports_descriptor_t *dsc;
322 mach_msg_type_number_t j;
323
324 /*
325 * Destroy port rights carried in the message
326 */
327 dsc = &saddr->ool_ports;
328 ports = (mach_port_t *) dsc->address;
329 for (j = 0; j < dsc->count; j++, ports++) {
330 mach_msg_destroy_port(*ports, dsc->disposition);
331 }
332
333 /*
334 * Destroy memory carried in the message
335 */
336 if (dsc->deallocate) {
337 mach_msg_destroy_memory((vm_offset_t)dsc->address,
338 dsc->count * sizeof(mach_port_t));
339 }
340 break;
341 }
342 }
343 }
344 }
345 }
346
347 /*
348 * Routine: mach_msg_server_once
349 * Purpose:
350 * A simple generic server function. It allows more flexibility
351 * than mach_msg_server by processing only one message request
352 * and then returning to the user. Note that more in the way
353 * of error codes are returned to the user; specifically, any
354 * failing error from mach_msg calls will be returned
355 * (though errors from the demux routine or the routine it
356 * calls will not be).
357 */
358 mach_msg_return_t
359 mach_msg_server_once(
360 boolean_t (*demux)(mach_msg_header_t *, mach_msg_header_t *),
361 mach_msg_size_t max_size,
362 mach_port_t rcv_name,
363 mach_msg_options_t options)
364 {
365 mig_reply_error_t *bufRequest, *bufReply;
366 mach_msg_size_t request_size;
367 mach_msg_size_t request_alloc;
368 mach_msg_size_t trailer_alloc;
369 mach_msg_size_t reply_alloc;
370 mach_msg_return_t mr;
371 kern_return_t kr;
372 mach_port_t self = mach_task_self();
373
374 options &= ~(MACH_SEND_MSG|MACH_RCV_MSG);
375
376 trailer_alloc = REQUESTED_TRAILER_SIZE(options);
377 request_alloc = round_page(max_size + trailer_alloc);
378
379 request_size = (options & MACH_RCV_LARGE) ?
380 request_alloc : max_size + trailer_alloc;
381
382 reply_alloc = round_page((options & MACH_SEND_TRAILER) ?
383 (max_size + MAX_TRAILER_SIZE) :
384 max_size);
385
386 kr = vm_allocate(self,
387 (vm_address_t *)&bufReply,
388 reply_alloc,
389 VM_MAKE_TAG(VM_MEMORY_MACH_MSG)|TRUE);
390 if (kr != KERN_SUCCESS)
391 return kr;
392
393 for (;;) {
394 mach_msg_size_t new_request_alloc;
395
396 kr = vm_allocate(self,
397 (vm_address_t *)&bufRequest,
398 request_alloc,
399 VM_MAKE_TAG(VM_MEMORY_MACH_MSG)|TRUE);
400 if (kr != KERN_SUCCESS) {
401 vm_deallocate(self,
402 (vm_address_t)bufReply,
403 reply_alloc);
404 return kr;
405 }
406
407 mr = mach_msg(&bufRequest->Head, MACH_RCV_MSG|options,
408 0, request_size, rcv_name,
409 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
410
411 if (!((mr == MACH_RCV_TOO_LARGE) && (options & MACH_RCV_LARGE)))
412 break;
413
414 new_request_alloc = round_page(bufRequest->Head.msgh_size +
415 trailer_alloc);
416 vm_deallocate(self,
417 (vm_address_t) bufRequest,
418 request_alloc);
419 request_size = request_alloc = new_request_alloc;
420 }
421
422 if (mr == MACH_MSG_SUCCESS) {
423 /* we have a request message */
424
425 (void) (*demux)(&bufRequest->Head, &bufReply->Head);
426
427 if (!(bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
428 if (bufReply->RetCode == MIG_NO_REPLY)
429 bufReply->Head.msgh_remote_port = MACH_PORT_NULL;
430 else if ((bufReply->RetCode != KERN_SUCCESS) &&
431 (bufRequest->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
432 /* destroy the request - but not the reply port */
433 bufRequest->Head.msgh_remote_port = MACH_PORT_NULL;
434 mach_msg_destroy(&bufRequest->Head);
435 }
436 }
437
438 /*
439 * We don't want to block indefinitely because the client
440 * isn't receiving messages from the reply port.
441 * If we have a send-once right for the reply port, then
442 * this isn't a concern because the send won't block.
443 * If we have a send right, we need to use MACH_SEND_TIMEOUT.
444 * To avoid falling off the kernel's fast RPC path unnecessarily,
445 * we only supply MACH_SEND_TIMEOUT when absolutely necessary.
446 */
447 if (bufReply->Head.msgh_remote_port != MACH_PORT_NULL) {
448
449 mr = mach_msg(&bufReply->Head,
450 (MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) ==
451 MACH_MSG_TYPE_MOVE_SEND_ONCE) ?
452 MACH_SEND_MSG|options :
453 MACH_SEND_MSG|MACH_SEND_TIMEOUT|options,
454 bufReply->Head.msgh_size, 0, MACH_PORT_NULL,
455 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
456
457 if ((mr != MACH_SEND_INVALID_DEST) &&
458 (mr != MACH_SEND_TIMED_OUT))
459 goto done_once;
460 mr = MACH_MSG_SUCCESS;
461 }
462 if (bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)
463 mach_msg_destroy(&bufReply->Head);
464 }
465
466 done_once:
467 (void)vm_deallocate(self,
468 (vm_address_t) bufRequest,
469 request_alloc);
470 (void)vm_deallocate(self,
471 (vm_address_t) bufReply,
472 reply_alloc);
473 return mr;
474 }
475
476 /*
477 * Routine: mach_msg_server
478 * Purpose:
479 * A simple generic server function. Note that changes here
480 * should be considered for duplication above.
481 */
482 mach_msg_return_t
483 mach_msg_server(
484 boolean_t (*demux)(mach_msg_header_t *, mach_msg_header_t *),
485 mach_msg_size_t max_size,
486 mach_port_t rcv_name,
487 mach_msg_options_t options)
488 {
489 mig_reply_error_t *bufRequest, *bufReply;
490 mach_msg_size_t request_size;
491 mach_msg_size_t new_request_alloc;
492 mach_msg_size_t request_alloc;
493 mach_msg_size_t trailer_alloc;
494 mach_msg_size_t reply_alloc;
495 mach_msg_return_t mr;
496 kern_return_t kr;
497 mach_port_t self = mach_task_self();
498
499 options &= ~(MACH_SEND_MSG|MACH_RCV_MSG);
500
501 reply_alloc = round_page((options & MACH_SEND_TRAILER) ?
502 (max_size + MAX_TRAILER_SIZE) : max_size);
503
504 kr = vm_allocate(self,
505 (vm_address_t *)&bufReply,
506 reply_alloc,
507 VM_MAKE_TAG(VM_MEMORY_MACH_MSG)|TRUE);
508 if (kr != KERN_SUCCESS)
509 return kr;
510
511 request_alloc = 0;
512 trailer_alloc = REQUESTED_TRAILER_SIZE(options);
513 new_request_alloc = round_page(max_size + trailer_alloc);
514
515 request_size = (options & MACH_RCV_LARGE) ?
516 new_request_alloc : max_size + trailer_alloc;
517
518 for (;;) {
519 if (request_alloc < new_request_alloc) {
520 request_alloc = new_request_alloc;
521 kr = vm_allocate(self,
522 (vm_address_t *)&bufRequest,
523 request_alloc,
524 VM_MAKE_TAG(VM_MEMORY_MACH_MSG)|TRUE);
525 if (kr != KERN_SUCCESS) {
526 vm_deallocate(self,
527 (vm_address_t)bufReply,
528 reply_alloc);
529 return kr;
530 }
531 }
532
533 mr = mach_msg(&bufRequest->Head, MACH_RCV_MSG|options,
534 0, request_size, rcv_name,
535 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
536
537 while (mr == MACH_MSG_SUCCESS) {
538 /* we have another request message */
539
540 (void) (*demux)(&bufRequest->Head, &bufReply->Head);
541
542 if (!(bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
543 if (bufReply->RetCode == MIG_NO_REPLY)
544 bufReply->Head.msgh_remote_port = MACH_PORT_NULL;
545 else if ((bufReply->RetCode != KERN_SUCCESS) &&
546 (bufRequest->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) {
547 /* destroy the request - but not the reply port */
548 bufRequest->Head.msgh_remote_port = MACH_PORT_NULL;
549 mach_msg_destroy(&bufRequest->Head);
550 }
551 }
552
553 /*
554 * We don't want to block indefinitely because the client
555 * isn't receiving messages from the reply port.
556 * If we have a send-once right for the reply port, then
557 * this isn't a concern because the send won't block.
558 * If we have a send right, we need to use MACH_SEND_TIMEOUT.
559 * To avoid falling off the kernel's fast RPC path,
560 * we only supply MACH_SEND_TIMEOUT when absolutely necessary.
561 */
562 if (bufReply->Head.msgh_remote_port != MACH_PORT_NULL) {
563 if (request_alloc == reply_alloc) {
564 mig_reply_error_t *bufTemp;
565
566 mr = mach_msg(
567 &bufReply->Head,
568 (MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) ==
569 MACH_MSG_TYPE_MOVE_SEND_ONCE) ?
570 MACH_SEND_MSG|MACH_RCV_MSG|options :
571 MACH_SEND_MSG|MACH_RCV_MSG|MACH_SEND_TIMEOUT|options,
572 bufReply->Head.msgh_size, request_size, rcv_name,
573 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
574
575 /* swap request and reply */
576 bufTemp = bufRequest;
577 bufRequest = bufReply;
578 bufReply = bufTemp;
579
580 } else {
581 mr = mach_msg_overwrite(
582 &bufReply->Head,
583 (MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) ==
584 MACH_MSG_TYPE_MOVE_SEND_ONCE) ?
585 MACH_SEND_MSG|MACH_RCV_MSG|options :
586 MACH_SEND_MSG|MACH_RCV_MSG|MACH_SEND_TIMEOUT|options,
587 bufReply->Head.msgh_size, request_size, rcv_name,
588 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL,
589 &bufRequest->Head, request_size);
590 }
591
592 if ((mr != MACH_SEND_INVALID_DEST) &&
593 (mr != MACH_SEND_TIMED_OUT))
594 continue;
595 }
596 if (bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)
597 mach_msg_destroy(&bufReply->Head);
598
599 mr = mach_msg(&bufRequest->Head, MACH_RCV_MSG|options,
600 0, request_size, rcv_name,
601 MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
602
603 } /* while (mr == MACH_MSG_SUCCESS) */
604
605 if ((mr == MACH_RCV_TOO_LARGE) && (options & MACH_RCV_LARGE)) {
606 new_request_alloc = round_page(bufRequest->Head.msgh_size +
607 trailer_alloc);
608 request_size = new_request_alloc;
609 vm_deallocate(self,
610 (vm_address_t) bufRequest,
611 request_alloc);
612 continue;
613 }
614
615 break;
616
617 } /* for(;;) */
618
619 (void)vm_deallocate(self,
620 (vm_address_t) bufRequest,
621 request_alloc);
622 (void)vm_deallocate(self,
623 (vm_address_t) bufReply,
624 reply_alloc);
625 return mr;
626 }