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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 mach_msg_options_t timeout_options = MACH_RCV_TIMEOUT | MACH_SEND_TIMEOUT | | 88 mach_msg_options_t timeout_options = MACH_RCV_TIMEOUT | MACH_SEND_TIMEOUT | |
89 MACH_RCV_INTERRUPT | MACH_SEND_INTERRUPT; | 89 MACH_RCV_INTERRUPT | MACH_SEND_INTERRUPT; |
90 | 90 |
91 uint64_t deadline; | 91 uint64_t deadline; |
92 if (nonblocking == kNonblocking) { | 92 if (nonblocking == kNonblocking) { |
93 options |= timeout_options; | 93 options |= timeout_options; |
94 deadline = 0; | 94 deadline = 0; |
95 } else if (timeout_ms != MACH_MSG_TIMEOUT_NONE) { | 95 } else if (timeout_ms != MACH_MSG_TIMEOUT_NONE) { |
96 options |= timeout_options; | 96 options |= timeout_options; |
97 deadline = ClockMonotonicNanoseconds() + | 97 deadline = ClockMonotonicNanoseconds() + |
98 static_cast<uint64_t>(timeout_ms) * kNanosecondsPerMillisecond; | 98 implicit_cast<uint64_t>(timeout_ms) * kNanosecondsPerMillisecond; |
99 } else { | 99 } else { |
100 options &= ~timeout_options; | 100 options &= ~timeout_options; |
101 deadline = 0; | 101 deadline = 0; |
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 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // persistent mode, and just return success when not in persistent mode. | 257 // persistent mode, and just return success when not in persistent mode. |
258 return (persistent == kPersistent) ? MACH_RCV_TIMED_OUT : kr; | 258 return (persistent == kPersistent) ? MACH_RCV_TIMED_OUT : kr; |
259 } | 259 } |
260 } | 260 } |
261 } while (persistent == kPersistent); | 261 } while (persistent == kPersistent); |
262 | 262 |
263 return kr; | 263 return kr; |
264 } | 264 } |
265 | 265 |
266 } // namespace crashpad | 266 } // namespace crashpad |
OLD | NEW |