Chromium Code Reviews| 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 // This file is used to handle differences in Mach message IDs and structures | 5 // This file is used to handle differences in Mach message IDs and structures |
| 6 // that occur between different OS versions. The Mach messages that the sandbox | 6 // that occur between different OS versions. The Mach messages that the sandbox |
| 7 // is interested in are decoded using information derived from the open-source | 7 // is interested in are decoded using information derived from the open-source |
| 8 // libraries, i.e. <http://www.opensource.apple.com/source/launchd/>. While | 8 // libraries, i.e. <http://www.opensource.apple.com/source/launchd/>. While |
| 9 // these messages definitions are open source, they are not considered part of | 9 // these messages definitions are open source, they are not considered part of |
| 10 // the stable OS API, and so differences do exist between OS versions. | 10 // the stable OS API, and so differences do exist between OS versions. |
| 11 | 11 |
| 12 #ifndef SANDBOX_MAC_OS_COMPATIBILITY_H_ | 12 #ifndef SANDBOX_MAC_OS_COMPATIBILITY_H_ |
| 13 #define SANDBOX_MAC_OS_COMPATIBILITY_H_ | 13 #define SANDBOX_MAC_OS_COMPATIBILITY_H_ |
| 14 | 14 |
| 15 #include <mach/mach.h> | 15 #include <mach/mach.h> |
| 16 | 16 |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 namespace sandbox { | 19 namespace sandbox { |
| 20 | 20 |
| 21 typedef std::string (*LookUp2GetRequestName)(const mach_msg_header_t*); | 21 typedef std::string (*LookUp2GetRequestName)(const mach_msg_header_t*); |
| 22 typedef void (*LookUp2FillReply)(mach_msg_header_t*, mach_port_t service_port); | 22 typedef void (*LookUp2FillReply)(mach_msg_header_t*, mach_port_t service_port); |
| 23 | 23 |
| 24 typedef bool (*SwapIntegerIsGetOnly)(const mach_msg_header_t*); | |
| 25 | |
| 24 struct LaunchdCompatibilityShim { | 26 struct LaunchdCompatibilityShim { |
| 25 // The msgh_id for look_up2. | 27 // The msgh_id for look_up2. |
| 26 mach_msg_id_t msg_id_look_up2; | 28 mach_msg_id_t msg_id_look_up2; |
| 27 | 29 |
| 28 // The msgh_id for swap_integer. | 30 // The msgh_id for swap_integer. |
| 29 mach_msg_id_t msg_id_swap_integer; | 31 mach_msg_id_t msg_id_swap_integer; |
| 30 | 32 |
| 31 // A function to take a look_up2 message and return the string service name | 33 // A function to take a look_up2 message and return the string service name |
| 32 // that was requested via the message. | 34 // that was requested via the message. |
| 33 LookUp2GetRequestName look_up2_get_request_name; | 35 LookUp2GetRequestName look_up2_get_request_name; |
| 34 | 36 |
| 35 // A function to formulate a reply to a look_up2 message, given the reply | 37 // A function to formulate a reply to a look_up2 message, given the reply |
| 36 // message and the port to return as the service. | 38 // message and the port to return as the service. |
| 37 LookUp2FillReply look_up2_fill_reply; | 39 LookUp2FillReply look_up2_fill_reply; |
| 40 | |
| 41 // A function to take a swap_integer message and return true if the message | |
| 42 // is only getting the value of a key, neither setting it directly, nor | |
| 43 // swapping two kes. | |
|
Mark Mentovai
2014/05/15 22:36:56
Spelling nit: keys.
I don’t actually see in the c
Robert Sesek
2014/05/15 22:54:17
Done.
| |
| 44 SwapIntegerIsGetOnly swap_integer_is_get_only; | |
| 38 }; | 45 }; |
| 39 | 46 |
| 40 // Gets the compatibility shim for the launchd job subsystem. | 47 // Gets the compatibility shim for the launchd job subsystem. |
| 41 const LaunchdCompatibilityShim GetLaunchdCompatibilityShim(); | 48 const LaunchdCompatibilityShim GetLaunchdCompatibilityShim(); |
| 42 | 49 |
| 43 } // namespace sandbox | 50 } // namespace sandbox |
| 44 | 51 |
| 45 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_ | 52 #endif // SANDBOX_MAC_OS_COMPATIBILITY_H_ |
| OLD | NEW |