| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 mach_msg_size_t trailer_alloc = REQUESTED_TRAILER_SIZE(options); | 104 mach_msg_size_t trailer_alloc = REQUESTED_TRAILER_SIZE(options); |
| 105 mach_msg_size_t max_request_size = interface->MachMessageServerRequestSize(); | 105 mach_msg_size_t max_request_size = interface->MachMessageServerRequestSize(); |
| 106 mach_msg_size_t request_alloc = round_page(max_request_size + trailer_alloc); | 106 mach_msg_size_t request_alloc = round_page(max_request_size + trailer_alloc); |
| 107 mach_msg_size_t request_size = (options & MACH_RCV_LARGE) | 107 mach_msg_size_t request_size = (options & MACH_RCV_LARGE) |
| 108 ? request_alloc | 108 ? request_alloc |
| 109 : max_request_size + trailer_alloc; | 109 : max_request_size + trailer_alloc; |
| 110 | 110 |
| 111 mach_msg_size_t max_reply_size = interface->MachMessageServerReplySize(); | 111 mach_msg_size_t max_reply_size = interface->MachMessageServerReplySize(); |
| 112 mach_msg_size_t reply_alloc = round_page( | 112 |
| 113 (options & MACH_SEND_TRAILER) ? (max_reply_size + MAX_TRAILER_SIZE) | 113 // mach_msg_server() and mach_msg_server_once() would consider whether |
| 114 : max_reply_size); | 114 // |options| contains MACH_SEND_TRAILER and include MAX_TRAILER_SIZE in this |
| 115 // computation if it does, but that option is ineffective on OS X. |
| 116 mach_msg_size_t reply_alloc = round_page(max_reply_size); |
| 115 | 117 |
| 116 kern_return_t kr; | 118 kern_return_t kr; |
| 117 | 119 |
| 118 do { | 120 do { |
| 119 mach_msg_size_t this_request_alloc = request_alloc; | 121 mach_msg_size_t this_request_alloc = request_alloc; |
| 120 mach_msg_size_t this_request_size = request_size; | 122 mach_msg_size_t this_request_size = request_size; |
| 121 | 123 |
| 122 base::mac::ScopedMachVM request_scoper; | 124 base::mac::ScopedMachVM request_scoper; |
| 123 mach_msg_header_t* request_header = nullptr; | 125 mach_msg_header_t* request_header = nullptr; |
| 124 | 126 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 // persistent mode, and just return success when not in persistent mode. | 259 // persistent mode, and just return success when not in persistent mode. |
| 258 return (persistent == kPersistent) ? MACH_RCV_TIMED_OUT : kr; | 260 return (persistent == kPersistent) ? MACH_RCV_TIMED_OUT : kr; |
| 259 } | 261 } |
| 260 } | 262 } |
| 261 } while (persistent == kPersistent); | 263 } while (persistent == kPersistent); |
| 262 | 264 |
| 263 return kr; | 265 return kr; |
| 264 } | 266 } |
| 265 | 267 |
| 266 } // namespace crashpad | 268 } // namespace crashpad |
| OLD | NEW |