| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 base::LaunchOptions options; | 224 base::LaunchOptions options; |
| 225 // Do not set NO_NEW_PRIVS on processes if the system is in dev-mode. This | 225 // Do not set NO_NEW_PRIVS on processes if the system is in dev-mode. This |
| 226 // permits sudo in the crosh shell when in developer mode. | 226 // permits sudo in the crosh shell when in developer mode. |
| 227 options.allow_new_privs = base::CommandLine::ForCurrentProcess()-> | 227 options.allow_new_privs = base::CommandLine::ForCurrentProcess()-> |
| 228 HasSwitch(chromeos::switches::kSystemInDevMode); | 228 HasSwitch(chromeos::switches::kSystemInDevMode); |
| 229 options.fds_to_remap = &fds_mapping; | 229 options.fds_to_remap = &fds_mapping; |
| 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 return base::LaunchProcess(CommandLine(base::FilePath(command)), options, | 234 return base::LaunchProcess(base::CommandLine(base::FilePath(command)), |
| 235 pid); | 235 options, pid); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void ProcessProxy::CloseAllFdPairs() { | 238 void ProcessProxy::CloseAllFdPairs() { |
| 239 CloseFdPair(pt_pair_); | 239 CloseFdPair(pt_pair_); |
| 240 CloseFdPair(shutdown_pipe_); | 240 CloseFdPair(shutdown_pipe_); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void ProcessProxy::CloseFdPair(int* pipe) { | 243 void ProcessProxy::CloseFdPair(int* pipe) { |
| 244 CloseFd(&(pipe[PIPE_END_READ])); | 244 CloseFd(&(pipe[PIPE_END_READ])); |
| 245 CloseFd(&(pipe[PIPE_END_WRITE])); | 245 CloseFd(&(pipe[PIPE_END_WRITE])); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 257 ClearFdPair(pt_pair_); | 257 ClearFdPair(pt_pair_); |
| 258 ClearFdPair(shutdown_pipe_); | 258 ClearFdPair(shutdown_pipe_); |
| 259 } | 259 } |
| 260 | 260 |
| 261 void ProcessProxy::ClearFdPair(int* pipe) { | 261 void ProcessProxy::ClearFdPair(int* pipe) { |
| 262 pipe[PIPE_END_READ] = kInvalidFd; | 262 pipe[PIPE_END_READ] = kInvalidFd; |
| 263 pipe[PIPE_END_WRITE] = kInvalidFd; | 263 pipe[PIPE_END_WRITE] = kInvalidFd; |
| 264 } | 264 } |
| 265 | 265 |
| 266 } // namespace chromeos | 266 } // namespace chromeos |
| OLD | NEW |