launchd.h 990 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_MAC_LAUNCHD_H_
  5. #define BASE_MAC_LAUNCHD_H_
  6. #include <launch.h>
  7. #include <sys/types.h>
  8. #include <string>
  9. #include "base/base_export.h"
  10. namespace base::mac {
  11. // MessageForJob sends a single message to launchd with a simple dictionary
  12. // mapping |operation| to |job_label|, and returns the result of calling
  13. // launch_msg to send that message. On failure, returns NULL. The caller
  14. // assumes ownership of the returned launch_data_t object.
  15. BASE_EXPORT
  16. launch_data_t MessageForJob(const std::string& job_label,
  17. const char* operation);
  18. // Returns the process ID for |job_label| if the job is running, 0 if the job
  19. // is loaded but not running, or -1 on error.
  20. BASE_EXPORT
  21. pid_t PIDForJob(const std::string& job_label);
  22. } // namespace base::mac
  23. #endif // BASE_MAC_LAUNCHD_H_