Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: base/process/process_handle_mac.cc

Issue 218883008: Use process_singleton_linux on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments (mostly) Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/process/process_handle_mac.cc
diff --git a/base/process/process_handle_mac.cc b/base/process/process_handle_mac.cc
index 6cb8d686e4d77c1a605e6d18b5f0613fb398da90..89d54e663e3fc8aac422d463d224b5f6084a0776 100644
--- a/base/process/process_handle_mac.cc
+++ b/base/process/process_handle_mac.cc
@@ -4,6 +4,7 @@
#include "base/process/process_handle.h"
+#include <libproc.h>
#include <sys/sysctl.h>
#include <sys/types.h>
@@ -24,4 +25,13 @@ ProcessId GetParentProcessId(ProcessHandle process) {
return info.kp_eproc.e_ppid;
Scott Hess - ex-Googler 2014/04/14 19:21:33 Weird, I wonder why this isn't just getppid()? Th
jackhou1 2014/04/17 07:55:54 Yeah, I'm not sure. I'll rope one of the authors o
mattm 2014/04/17 21:44:54 Heh, I had to stare at it a while too. It's becaus
}
+
Scott Hess - ex-Googler 2014/04/14 19:21:33 excess newline.
jackhou1 2014/04/17 07:55:54 Done.
+FilePath GetProcessExecutablePath(ProcessHandle process) {
+ char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
Scott Hess - ex-Googler 2014/04/14 19:21:33 This seems weird - this constant is defined as 4*M
jackhou1 2014/04/17 07:55:54 Yeah I think 4* MAXPATHLEN just happens to be the
+ if (!proc_pidpath(process, pathbuf, sizeof(pathbuf)))
+ return FilePath();
+
+ return FilePath(pathbuf);
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698