| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sandbox/mac/os_compatibility.h" | 5 #include "sandbox/mac/os_compatibility.h" |
| 6 | 6 |
| 7 #include <servers/bootstrap.h> | 7 #include <servers/bootstrap.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 template <typename R> | 81 template <typename R> |
| 82 void LaunchdLookUp2FillReply(mach_msg_header_t* header, mach_port_t port) { | 82 void LaunchdLookUp2FillReply(mach_msg_header_t* header, mach_port_t port) { |
| 83 R* reply = reinterpret_cast<R*>(header); | 83 R* reply = reinterpret_cast<R*>(header); |
| 84 reply->Head.msgh_size = sizeof(R); | 84 reply->Head.msgh_size = sizeof(R); |
| 85 reply->Head.msgh_bits = | 85 reply->Head.msgh_bits = |
| 86 MACH_MSGH_BITS_REMOTE(MACH_MSG_TYPE_MOVE_SEND_ONCE) | | 86 MACH_MSGH_BITS_REMOTE(MACH_MSG_TYPE_MOVE_SEND_ONCE) | |
| 87 MACH_MSGH_BITS_COMPLEX; | 87 MACH_MSGH_BITS_COMPLEX; |
| 88 reply->msgh_body.msgh_descriptor_count = 1; | 88 reply->msgh_body.msgh_descriptor_count = 1; |
| 89 reply->service_port.name = port; | 89 reply->service_port.name = port; |
| 90 reply->service_port.disposition = MACH_MSG_TYPE_PORT_SEND; | 90 reply->service_port.disposition = MACH_MSG_TYPE_COPY_SEND; |
| 91 reply->service_port.type = MACH_MSG_PORT_DESCRIPTOR; | 91 reply->service_port.type = MACH_MSG_PORT_DESCRIPTOR; |
| 92 } | 92 } |
| 93 | 93 |
| 94 template <typename R> | 94 template <typename R> |
| 95 bool LaunchdSwapIntegerIsGetOnly(const mach_msg_header_t* header) { | 95 bool LaunchdSwapIntegerIsGetOnly(const mach_msg_header_t* header) { |
| 96 const R* request = reinterpret_cast<const R*>(header); | 96 const R* request = reinterpret_cast<const R*>(header); |
| 97 return request->inkey == 0 && request->inval == 0 && request->outkey != 0; | 97 return request->inkey == 0 && request->inval == 0 && request->outkey != 0; |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace | 100 } // namespace |
| (...skipping 17 matching lines...) Expand all Loading... |
| 118 } else { | 118 } else { |
| 119 DLOG(ERROR) << "Unknown OS, using launchd compatibility shim from 10.7."; | 119 DLOG(ERROR) << "Unknown OS, using launchd compatibility shim from 10.7."; |
| 120 shim.look_up2_get_request_name = | 120 shim.look_up2_get_request_name = |
| 121 &LaunchdLookUp2GetRequestName<look_up2_request_10_7>; | 121 &LaunchdLookUp2GetRequestName<look_up2_request_10_7>; |
| 122 } | 122 } |
| 123 | 123 |
| 124 return shim; | 124 return shim; |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace sandbox | 127 } // namespace sandbox |
| OLD | NEW |