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

Side by Side Diff: base/process/process_handle_mac.cc

Issue 1180583002: GN updates to build base on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« base/process/BUILD.gn ('K') | « base/process/process_handle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process/process_handle.h" 5 #include "base/process/process_handle.h"
6 6
7 #if !defined(OS_IOS)
Nico 2015/06/11 15:37:59 base builds fine for ios in the gyp build. why do
sdefresne 2015/06/11 17:05:17 I suspect you miss some system directory with gn.
Chinmay 2015/06/11 17:44:36 libproc.h is only present on the iPhone Simulator
sdefresne 2015/06/11 17:54:32 I've checked my gyp build and process_handle_mac.c
7 #include <libproc.h> 8 #include <libproc.h>
9 #endif
10
8 #include <sys/sysctl.h> 11 #include <sys/sysctl.h>
9 #include <sys/types.h> 12 #include <sys/types.h>
10 13
11 #include "base/logging.h" 14 #include "base/logging.h"
12 15
13 namespace base { 16 namespace base {
14 17
15 ProcessId GetParentProcessId(ProcessHandle process) { 18 ProcessId GetParentProcessId(ProcessHandle process) {
16 struct kinfo_proc info; 19 struct kinfo_proc info;
17 size_t length = sizeof(struct kinfo_proc); 20 size_t length = sizeof(struct kinfo_proc);
18 int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process }; 21 int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
19 if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) { 22 if (sysctl(mib, 4, &info, &length, NULL, 0) < 0) {
20 DPLOG(ERROR) << "sysctl"; 23 DPLOG(ERROR) << "sysctl";
21 return -1; 24 return -1;
22 } 25 }
23 if (length == 0) 26 if (length == 0)
24 return -1; 27 return -1;
25 return info.kp_eproc.e_ppid; 28 return info.kp_eproc.e_ppid;
26 } 29 }
27 30
31 #if !defined(OS_IOS)
32
28 FilePath GetProcessExecutablePath(ProcessHandle process) { 33 FilePath GetProcessExecutablePath(ProcessHandle process) {
29 char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; 34 char pathbuf[PROC_PIDPATHINFO_MAXSIZE];
30 if (!proc_pidpath(process, pathbuf, sizeof(pathbuf))) 35 if (!proc_pidpath(process, pathbuf, sizeof(pathbuf)))
31 return FilePath(); 36 return FilePath();
32 37
33 return FilePath(pathbuf); 38 return FilePath(pathbuf);
34 } 39 }
35 40
41 #endif
42
36 } // namespace base 43 } // namespace base
OLDNEW
« base/process/BUILD.gn ('K') | « base/process/process_handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698