OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 | 5 |
6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <crt_externs.h> | 9 #include <crt_externs.h> |
10 #include <spawn.h> | 10 #include <spawn.h> |
11 #include <sys/sysctl.h> | 11 #include <sys/sysctl.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 #include <sys/wait.h> | 13 #include <sys/wait.h> |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
| 17 #include "base/eintr_wrappers.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/time.h" | 20 #include "base/time.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 | 23 |
23 bool LaunchApp(const std::vector<std::string>& argv, | 24 bool LaunchApp(const std::vector<std::string>& argv, |
24 const file_handle_mapping_vector& fds_to_remap, | 25 const file_handle_mapping_vector& fds_to_remap, |
25 bool wait, ProcessHandle* process_handle) { | 26 bool wait, ProcessHandle* process_handle) { |
26 bool retval = true; | 27 bool retval = true; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 argv_copy, | 70 argv_copy, |
70 *_NSGetEnviron()) == 0); | 71 *_NSGetEnviron()) == 0); |
71 | 72 |
72 posix_spawn_file_actions_destroy(&file_actions); | 73 posix_spawn_file_actions_destroy(&file_actions); |
73 | 74 |
74 bool process_handle_valid = pid > 0; | 75 bool process_handle_valid = pid > 0; |
75 if (!spawn_succeeded || !process_handle_valid) { | 76 if (!spawn_succeeded || !process_handle_valid) { |
76 retval = false; | 77 retval = false; |
77 } else { | 78 } else { |
78 if (wait) | 79 if (wait) |
79 waitpid(pid, 0, 0); | 80 HANDLE_EINTR(waitpid(pid, 0, 0)); |
80 | 81 |
81 if (process_handle) | 82 if (process_handle) |
82 *process_handle = pid; | 83 *process_handle = pid; |
83 } | 84 } |
84 | 85 |
85 return retval; | 86 return retval; |
86 } | 87 } |
87 | 88 |
88 bool LaunchApp(const CommandLine& cl, | 89 bool LaunchApp(const CommandLine& cl, |
89 bool wait, bool start_hidden, ProcessHandle* process_handle) { | 90 bool wait, bool start_hidden, ProcessHandle* process_handle) { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return filter_->Includes(entry_.pid, entry_.ppid); | 227 return filter_->Includes(entry_.pid, entry_.ppid); |
227 } | 228 } |
228 | 229 |
229 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { | 230 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { |
230 // TODO(pinkerton): can we implement this? On linux it relies on /proc. | 231 // TODO(pinkerton): can we implement this? On linux it relies on /proc. |
231 NOTIMPLEMENTED(); | 232 NOTIMPLEMENTED(); |
232 return false; | 233 return false; |
233 } | 234 } |
234 | 235 |
235 } // namespace base | 236 } // namespace base |
OLD | NEW |