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" |
11 | 11 |
12 namespace sandbox { | 12 namespace sandbox { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
| 16 #pragma pack(push, 4) |
16 // Verified from launchd-329.3.3 (10.6.8). | 17 // Verified from launchd-329.3.3 (10.6.8). |
17 struct look_up2_request_10_6 { | 18 struct look_up2_request_10_6 { |
18 mach_msg_header_t Head; | 19 mach_msg_header_t Head; |
19 NDR_record_t NDR; | 20 NDR_record_t NDR; |
20 name_t servicename; | 21 name_t servicename; |
21 pid_t targetpid; | 22 pid_t targetpid; |
22 uint64_t flags; | 23 uint64_t flags; |
23 }; | 24 }; |
24 | 25 |
25 struct look_up2_reply_10_6 { | 26 struct look_up2_reply_10_6 { |
(...skipping 23 matching lines...) Expand all Loading... |
49 // launchd-442.26.2 (10.8.5) | 50 // launchd-442.26.2 (10.8.5) |
50 // launchd-842.1.4 (10.9.0) | 51 // launchd-842.1.4 (10.9.0) |
51 typedef int vproc_gsk_t; // Defined as an enum in liblaunch/vproc_priv.h. | 52 typedef int vproc_gsk_t; // Defined as an enum in liblaunch/vproc_priv.h. |
52 struct swap_integer_request_10_6 { | 53 struct swap_integer_request_10_6 { |
53 mach_msg_header_t Head; | 54 mach_msg_header_t Head; |
54 NDR_record_t NDR; | 55 NDR_record_t NDR; |
55 vproc_gsk_t inkey; | 56 vproc_gsk_t inkey; |
56 vproc_gsk_t outkey; | 57 vproc_gsk_t outkey; |
57 int64_t inval; | 58 int64_t inval; |
58 }; | 59 }; |
| 60 #pragma pack(pop) |
59 | 61 |
60 // TODO(rsesek): Libc provides strnlen() starting in 10.7. | 62 // TODO(rsesek): Libc provides strnlen() starting in 10.7. |
61 size_t strnlen(const char* str, size_t maxlen) { | 63 size_t strnlen(const char* str, size_t maxlen) { |
62 size_t len = 0; | 64 size_t len = 0; |
63 for (; len < maxlen; ++len, ++str) { | 65 for (; len < maxlen; ++len, ++str) { |
64 if (*str == '\0') | 66 if (*str == '\0') |
65 break; | 67 break; |
66 } | 68 } |
67 return len; | 69 return len; |
68 } | 70 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } else { | 126 } else { |
125 DLOG(ERROR) << "Unknown OS, using launchd compatibility shim from 10.7."; | 127 DLOG(ERROR) << "Unknown OS, using launchd compatibility shim from 10.7."; |
126 shim.look_up2_get_request_name = | 128 shim.look_up2_get_request_name = |
127 &LaunchdLookUp2GetRequestName<look_up2_request_10_7>; | 129 &LaunchdLookUp2GetRequestName<look_up2_request_10_7>; |
128 } | 130 } |
129 | 131 |
130 return shim; | 132 return shim; |
131 } | 133 } |
132 | 134 |
133 } // namespace sandbox | 135 } // namespace sandbox |
OLD | NEW |