Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (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 | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 | |
| 15 #ifndef CRASHPAD_UTIL_MAC_SERVICE_MANAGEMENT_H_ | |
| 16 #define CRASHPAD_UTIL_MAC_SERVICE_MANAGEMENT_H_ | |
| 17 | |
| 18 #include <CoreFoundation/CoreFoundation.h> | |
| 19 #include <unistd.h> | |
| 20 | |
| 21 #include <string> | |
| 22 | |
| 23 namespace crashpad { | |
| 24 | |
| 25 //! \brief Submits a job to the user launchd domain as in `SMJobSubmit()`. | |
| 26 //! | |
| 27 //! \param[in] job_cf A dictionary describing a job. | |
| 28 //! | |
| 29 //! \return `true` if the job was submitted successfully, otherwise `false`. | |
| 30 //! | |
| 31 //! \note This function is provided because `SMJobSubmit()` does not exist prior | |
| 32 //! to Mac OS X 10.6, and behaves flakily on Mac OS X 10.10 DP2 14A261i in | |
| 33 //! that it hangs 25% of the time (radar 17365104). | |
| 34 bool ServiceManagementSubmitJob(CFDictionaryRef job_cf); | |
| 35 | |
| 36 //! \brief Removes a job from the user launchd domain as in `SMJobRemove()`. | |
| 37 //! | |
| 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 | |
| 40 //! be removed. `false` if the job may be removed asynchronously. | |
| 41 //! | |
| 42 //! \return `true` if the job was removed successfully, otherwise `false`. | |
|
Robert Sesek
2014/08/14 20:27:22
What does this return if the job is removed asynch
| |
| 43 //! | |
| 44 //! \note This function is provided because `SMJobRemove()` does not exist prior | |
| 45 //! to Mac OS X 10.6, and when \a wait is true, blocks for far too long on | |
| 46 //! Mac OS X 10.10 DP2 14A261i (radar 17365104; `_block_until_job_exits()` | |
| 47 //! contains a one-second sleep() call). | |
| 48 bool ServiceManagementRemoveJob(const std::string& label, bool wait); | |
| 49 | |
| 50 //! \brief Determines whether a specified job is loaded in the user launchd | |
| 51 //! domain. | |
| 52 //! | |
| 53 //! \param[in] label The label for the job to look up. | |
| 54 //! | |
| 55 //! \return `true` if the job is loaded, otherwise `false`. | |
| 56 //! | |
| 57 //! \note A loaded job is not necessarily presently running, nor has it | |
| 58 //! necessarily ever run in the past. | |
| 59 //! \note This function is provided because `SMJobCopyDictionary()` does not | |
| 60 //! exist prior to Mac OS X 10.6, and on Mac OS X 10.10 DP2 14a261i, it | |
|
Robert Sesek
2014/08/14 20:27:22
What about in DP5?
| |
| 61 //! fails to return a job dictionary immediately after a job is loaded | |
| 62 //! (radar 17365104). | |
| 63 bool ServiceManagementIsJobLoaded(const std::string& label); | |
| 64 | |
| 65 //! \brief Determines whether a specified job is running in the user launchd | |
| 66 //! domain. | |
| 67 //! | |
| 68 //! \param[in] label The label for the job to look up. | |
| 69 //! | |
| 70 //! \return The job’s process ID if running, otherwise `0`. | |
| 71 //! | |
| 72 //! \note This function is provided because `SMJobCopyDictionary()` does not | |
| 73 //! exist prior to Mac OS X 10.6, and on Mac OS X 10.10 DP2 14a261i, it | |
| 74 //! fails to return a job dictionary immediately after a job is loaded | |
| 75 //! (radar 17365104). | |
| 76 pid_t ServiceManagementIsJobRunning(const std::string& label); | |
| 77 | |
| 78 } // namespace crashpad | |
| 79 | |
| 80 #endif // CRASHPAD_UTIL_MAC_SERVICE_MANAGEMENT | |
| OLD | NEW |