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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #ifndef CRASHPAD_UTIL_MAC_MAC_UTIL_H_ | 15 #ifndef CRASHPAD_UTIL_MAC_MAC_UTIL_H_ |
16 #define CRASHPAD_UTIL_MAC_MAC_UTIL_H_ | 16 #define CRASHPAD_UTIL_MAC_MAC_UTIL_H_ |
17 | 17 |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 namespace crashpad { | 20 namespace crashpad { |
21 | 21 |
22 //! \brief Returns the version of the running operating system. | 22 //! \brief Returns the version of the running operating system. |
23 //! | 23 //! |
24 //! \return The minor version of the operating system, such as `9` for Mac OS X | 24 //! \return The minor version of the operating system, such as `12` for macOS |
25 //! 10.9.2. | 25 //! 10.12.1. |
26 //! | 26 //! |
27 //! \note This is similar to the base::mac::IsOS*() family of functions, but | 27 //! \note This is similar to the base::mac::IsOS*() family of functions, but |
28 //! is provided for situations where the caller needs to obtain version | 28 //! is provided for situations where the caller needs to obtain version |
29 //! information beyond what is provided by Chromium’s base, or for when the | 29 //! information beyond what is provided by Chromium’s base, or for when the |
30 //! caller needs the actual minor version value. | 30 //! caller needs the actual minor version value. |
31 int MacOSXMinorVersion(); | 31 int MacOSXMinorVersion(); |
32 | 32 |
33 //! \brief Returns the version of the running operating system. | 33 //! \brief Returns the version of the running operating system. |
34 //! | 34 //! |
35 //! All parameters are required. No parameter may be `nullptr`. | 35 //! All parameters are required. No parameter may be `nullptr`. |
36 //! | 36 //! |
37 //! \param[out] major The major version of the operating system, such as `10` | 37 //! \param[out] major The major version of the operating system, such as `10` |
38 //! for Mac OS X 10.9.2. | 38 //! for macOS 10.12.1. |
39 //! \param[out] minor The major version of the operating system, such as `9` for | 39 //! \param[out] minor The major version of the operating system, such as `12` |
40 //! Mac OS X 10.9.2. | 40 //! for macOS 10.12.1. |
41 //! \param[out] bugfix The bugfix version of the operating system, such as `2` | 41 //! \param[out] bugfix The bugfix version of the operating system, such as `1` |
42 //! for Mac OS X 10.9.2. | 42 //! for macOS 10.12.1. |
43 //! \param[out] build The operating system’s build string, such as "13C64" for | 43 //! \param[out] build The operating system’s build string, such as `"16B2657"` |
44 //! Mac OS X 10.9.2. | 44 //! for macOS 10.12.1. |
45 //! \param[out] server `true` for a Mac OS X Server installation, `false` | 45 //! \param[out] server `true` for a macOS Server installation, `false` otherwise |
46 //! otherwise (for a desktop/laptop, client, or workstation system). | 46 //! (for a desktop/laptop, client, or workstation system). |
47 //! \param[out] version_string A string representing the full operating system | 47 //! \param[out] version_string A string representing the full operating system |
48 //! version, such as `"Mac OS X 10.9.2 (13C64)"`. | 48 //! version, such as `"macOS 10.12.1 (16B2657)"`. |
49 //! | 49 //! |
50 //! \return `true` on success, `false` on failure, with an error message logged. | 50 //! \return `true` on success, `false` on failure, with an error message logged. |
51 //! A failure is considered to have occurred if any element could not be | 51 //! A failure is considered to have occurred if any element could not be |
52 //! determined. When this happens, their values will be untouched, but other | 52 //! determined. When this happens, their values will be untouched, but other |
53 //! values that could be determined will still be set properly. | 53 //! values that could be determined will still be set properly. |
54 bool MacOSXVersion(int* major, | 54 bool MacOSXVersion(int* major, |
55 int* minor, | 55 int* minor, |
56 int* bugfix, | 56 int* bugfix, |
57 std::string* build, | 57 std::string* build, |
58 bool* server, | 58 bool* server, |
59 std::string* version_string); | 59 std::string* version_string); |
60 | 60 |
61 //! \brief Returns the model name and board ID of the running system. | 61 //! \brief Returns the model name and board ID of the running system. |
62 //! | 62 //! |
63 //! \param[out] model The system’s model name. A mid-2012 15" MacBook Pro would | 63 //! \param[out] model The system’s model name. A mid-2012 15" MacBook Pro would |
64 //! report “MacBookPro10,1”. | 64 //! report “MacBookPro10,1”. |
65 //! \param[out] board_id The system’s board ID. A mid-2012 15" MacBook Pro would | 65 //! \param[out] board_id The system’s board ID. A mid-2012 15" MacBook Pro would |
66 //! report “Mac-C3EC7CD22292981F”. | 66 //! report “Mac-C3EC7CD22292981F”. |
67 //! | 67 //! |
68 //! If a value cannot be determined, its string is cleared. | 68 //! If a value cannot be determined, its string is cleared. |
69 void MacModelAndBoard(std::string* model, std::string* board_id); | 69 void MacModelAndBoard(std::string* model, std::string* board_id); |
70 | 70 |
71 } // namespace crashpad | 71 } // namespace crashpad |
72 | 72 |
73 #endif // CRASHPAD_UTIL_MAC_MAC_UTIL_H_ | 73 #endif // CRASHPAD_UTIL_MAC_MAC_UTIL_H_ |
OLD | NEW |