summaryrefslogtreecommitdiffstats
path: root/base/process_util_mac.mm
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 17:14:36 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-24 17:14:36 +0000
commit56f0f264ff866052ebcb24e75147cb600e6547a1 (patch)
tree8b16bded93f914cacbf3cb130fae3539ad4bb268 /base/process_util_mac.mm
parent04a8454da64b62bfad5091efd5cf1143443283f0 (diff)
downloadchromium_src-56f0f264ff866052ebcb24e75147cb600e6547a1.zip
chromium_src-56f0f264ff866052ebcb24e75147cb600e6547a1.tar.gz
chromium_src-56f0f264ff866052ebcb24e75147cb600e6547a1.tar.bz2
Get service process running standalone on the mac by hooking it into launchd.
BUG=NONE TEST=BUILD Review URL: http://codereview.chromium.org/6482016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_mac.mm')
-rw-r--r--base/process_util_mac.mm13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index aa0f14d..6d05581 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -880,4 +880,17 @@ void EnableTerminationOnOutOfMemory() {
reinterpret_cast<IMP>(oom_killer_allocWithZone));
}
+ProcessId GetParentProcessId(ProcessHandle process) {
+ struct kinfo_proc info;
+ size_t length = sizeof(struct kinfo_proc);
+ int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
+ if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) {
+ PLOG(ERROR) << "sysctl";
+ return -1;
+ }
+ if (length == 0)
+ return -1;
+ return info.kp_eproc.e_ppid;
+}
+
} // namespace base