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 10 matching lines...) Expand all Loading... |
21 #include <string> | 21 #include <string> |
22 | 22 |
23 namespace crashpad { | 23 namespace crashpad { |
24 | 24 |
25 //! \brief Submits a job to the user launchd domain as in `SMJobSubmit()`. | 25 //! \brief Submits a job to the user launchd domain as in `SMJobSubmit()`. |
26 //! | 26 //! |
27 //! \param[in] job_cf A dictionary describing a job. | 27 //! \param[in] job_cf A dictionary describing a job. |
28 //! | 28 //! |
29 //! \return `true` if the job was submitted successfully, otherwise `false`. | 29 //! \return `true` if the job was submitted successfully, otherwise `false`. |
30 //! | 30 //! |
31 //! \note This function is provided because `SMJobSubmit()` is deprecated in Mac | 31 //! \note This function is provided because `SMJobSubmit()` is deprecated in OS |
32 //! OS X 10.10. It may or may not be implemented using `SMJobSubmit()` from | 32 //! X 10.10. It may or may not be implemented using `SMJobSubmit()` from |
33 //! `ServiceManagement.framework`. | 33 //! `ServiceManagement.framework`. |
34 bool ServiceManagementSubmitJob(CFDictionaryRef job_cf); | 34 bool ServiceManagementSubmitJob(CFDictionaryRef job_cf); |
35 | 35 |
36 //! \brief Removes a job from the user launchd domain as in `SMJobRemove()`. | 36 //! \brief Removes a job from the user launchd domain as in `SMJobRemove()`. |
37 //! | 37 //! |
38 //! \param[in] label The label for the job to remove. | 38 //! \param[in] label The label for the job to remove. |
39 //! \param[in] wait `true` if this function should block, waiting for the job to | 39 //! \param[in] wait `true` if this function should block, waiting for the job to |
40 //! be removed. `false` if the job may be removed asynchronously. | 40 //! be removed. `false` if the job may be removed asynchronously. |
41 //! | 41 //! |
42 //! \return `true` if the job was removed successfully or if an asynchronous | 42 //! \return `true` if the job was removed successfully or if an asynchronous |
43 //! attempt to remove the job was started successfully, otherwise `false`. | 43 //! attempt to remove the job was started successfully, otherwise `false`. |
44 //! | 44 //! |
45 //! \note This function is provided because `SMJobRemove()` is deprecated in Mac | 45 //! \note This function is provided because `SMJobRemove()` is deprecated in OS |
46 //! OS X 10.10. On Mac OS X 10.10, observed in DP8 14A361c, it also blocks | 46 //! X 10.10. On OS X 10.10, observed in DP8 14A361c, it also blocks for far |
47 //! for far too long (`_block_until_job_exits()` contains a one-second | 47 //! too long (`_block_until_job_exits()` contains a one-second `sleep()`, |
48 //! `sleep()`, filed as radar 18398683) and does not signal failure via its | 48 //! filed as radar 18398683) and does not signal failure via its return |
49 //! return value when asked to remove a nonexistent job (filed as radar | 49 //! value when asked to remove a nonexistent job (filed as radar 18268941). |
50 //! 18268941). | |
51 bool ServiceManagementRemoveJob(const std::string& label, bool wait); | 50 bool ServiceManagementRemoveJob(const std::string& label, bool wait); |
52 | 51 |
53 //! \brief Determines whether a specified job is loaded in the user launchd | 52 //! \brief Determines whether a specified job is loaded in the user launchd |
54 //! domain. | 53 //! domain. |
55 //! | 54 //! |
56 //! \param[in] label The label for the job to look up. | 55 //! \param[in] label The label for the job to look up. |
57 //! | 56 //! |
58 //! \return `true` if the job is loaded, otherwise `false`. | 57 //! \return `true` if the job is loaded, otherwise `false`. |
59 //! | 58 //! |
60 //! \note A loaded job is not necessarily presently running, nor has it | 59 //! \note A loaded job is not necessarily presently running, nor has it |
61 //! necessarily ever run in the past. | 60 //! necessarily ever run in the past. |
62 //! \note This function is provided because `SMJobCopyDictionary()` is | 61 //! \note This function is provided because `SMJobCopyDictionary()` is |
63 //! deprecated in Mac OS X 10.10. It may or may not be implemented using | 62 //! deprecated in OS X 10.10. It may or may not be implemented using |
64 //! `SMJobCopyDictionary()` from `ServiceManagement.framework`. | 63 //! `SMJobCopyDictionary()` from `ServiceManagement.framework`. |
65 bool ServiceManagementIsJobLoaded(const std::string& label); | 64 bool ServiceManagementIsJobLoaded(const std::string& label); |
66 | 65 |
67 //! \brief Determines whether a specified job is running in the user launchd | 66 //! \brief Determines whether a specified job is running in the user launchd |
68 //! domain. | 67 //! domain. |
69 //! | 68 //! |
70 //! \param[in] label The label for the job to look up. | 69 //! \param[in] label The label for the job to look up. |
71 //! | 70 //! |
72 //! \return The job’s process ID if running, otherwise `0`. | 71 //! \return The job’s process ID if running, otherwise `0`. |
73 //! | 72 //! |
74 //! \note This function is provided because `SMJobCopyDictionary()` is | 73 //! \note This function is provided because `SMJobCopyDictionary()` is |
75 //! deprecated in Mac OS X 10.10. It may or may not be implemented using | 74 //! deprecated in OS X 10.10. It may or may not be implemented using |
76 //! `SMJobCopyDictionary()` from `ServiceManagement.framework`. | 75 //! `SMJobCopyDictionary()` from `ServiceManagement.framework`. |
77 pid_t ServiceManagementIsJobRunning(const std::string& label); | 76 pid_t ServiceManagementIsJobRunning(const std::string& label); |
78 | 77 |
79 } // namespace crashpad | 78 } // namespace crashpad |
80 | 79 |
81 #endif // CRASHPAD_UTIL_MAC_SERVICE_MANAGEMENT | 80 #endif // CRASHPAD_UTIL_MAC_SERVICE_MANAGEMENT |
OLD | NEW |