OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chromeos/process_proxy/process_proxy.h" | 5 #include "chromeos/process_proxy/process_proxy.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/ioctl.h> | 9 #include <sys/ioctl.h> |
10 | 10 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 options.ctrl_terminal_fd = slave_fd; | 230 options.ctrl_terminal_fd = slave_fd; |
231 options.environ["TERM"] = "xterm"; | 231 options.environ["TERM"] = "xterm"; |
232 | 232 |
233 // Launch the process. | 233 // Launch the process. |
234 base::Process process = | 234 base::Process process = |
235 base::LaunchProcess(base::CommandLine(base::FilePath(command)), options); | 235 base::LaunchProcess(base::CommandLine(base::FilePath(command)), options); |
236 | 236 |
237 // TODO(rvargas) crbug/417532: This is somewhat wrong but the interface of | 237 // TODO(rvargas) crbug/417532: This is somewhat wrong but the interface of |
238 // Open vends pid_t* so ownership is quite vague anyway, and Process::Close | 238 // Open vends pid_t* so ownership is quite vague anyway, and Process::Close |
239 // doesn't do much in POSIX. | 239 // doesn't do much in POSIX. |
240 *pid = process.pid(); | 240 *pid = process.Pid(); |
241 return process.IsValid(); | 241 return process.IsValid(); |
242 } | 242 } |
243 | 243 |
244 void ProcessProxy::CloseAllFdPairs() { | 244 void ProcessProxy::CloseAllFdPairs() { |
245 CloseFdPair(pt_pair_); | 245 CloseFdPair(pt_pair_); |
246 CloseFdPair(shutdown_pipe_); | 246 CloseFdPair(shutdown_pipe_); |
247 } | 247 } |
248 | 248 |
249 void ProcessProxy::CloseFdPair(int* pipe) { | 249 void ProcessProxy::CloseFdPair(int* pipe) { |
250 CloseFd(&(pipe[PIPE_END_READ])); | 250 CloseFd(&(pipe[PIPE_END_READ])); |
(...skipping 12 matching lines...) Expand all Loading... |
263 ClearFdPair(pt_pair_); | 263 ClearFdPair(pt_pair_); |
264 ClearFdPair(shutdown_pipe_); | 264 ClearFdPair(shutdown_pipe_); |
265 } | 265 } |
266 | 266 |
267 void ProcessProxy::ClearFdPair(int* pipe) { | 267 void ProcessProxy::ClearFdPair(int* pipe) { |
268 pipe[PIPE_END_READ] = kInvalidFd; | 268 pipe[PIPE_END_READ] = kInvalidFd; |
269 pipe[PIPE_END_WRITE] = kInvalidFd; | 269 pipe[PIPE_END_WRITE] = kInvalidFd; |
270 } | 270 } |
271 | 271 |
272 } // namespace chromeos | 272 } // namespace chromeos |
OLD | NEW |