| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 #include <dirent.h> | 5 #include <dirent.h> |
| 6 #include <errno.h> | 6 #include <errno.h> |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/resource.h> | 10 #include <sys/resource.h> |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 max_fds = INT_MAX; | 214 max_fds = INT_MAX; |
| 215 | 215 |
| 216 DirReaderPosix fd_dir(kFDDir); | 216 DirReaderPosix fd_dir(kFDDir); |
| 217 | 217 |
| 218 if (!fd_dir.IsValid()) { | 218 if (!fd_dir.IsValid()) { |
| 219 // Fallback case: Try every possible fd. | 219 // Fallback case: Try every possible fd. |
| 220 for (rlim_t i = 0; i < max_fds; ++i) { | 220 for (rlim_t i = 0; i < max_fds; ++i) { |
| 221 const int fd = static_cast<int>(i); | 221 const int fd = static_cast<int>(i); |
| 222 if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) | 222 if (fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO) |
| 223 continue; | 223 continue; |
| 224 InjectiveMultimap::const_iterator i; | 224 InjectiveMultimap::const_iterator j; |
| 225 for (i = saved_mapping.begin(); i != saved_mapping.end(); i++) { | 225 for (j = saved_mapping.begin(); j != saved_mapping.end(); j++) { |
| 226 if (fd == i->dest) | 226 if (fd == j->dest) |
| 227 break; | 227 break; |
| 228 } | 228 } |
| 229 if (i != saved_mapping.end()) | 229 if (j != saved_mapping.end()) |
| 230 continue; | 230 continue; |
| 231 | 231 |
| 232 // Since we're just trying to close anything we can find, | 232 // Since we're just trying to close anything we can find, |
| 233 // ignore any error return values of close(). | 233 // ignore any error return values of close(). |
| 234 int unused ALLOW_UNUSED = HANDLE_EINTR(close(fd)); | 234 int unused ALLOW_UNUSED = HANDLE_EINTR(close(fd)); |
| 235 } | 235 } |
| 236 return; | 236 return; |
| 237 } | 237 } |
| 238 | 238 |
| 239 const int dir_fd = fd_dir.fd(); | 239 const int dir_fd = fd_dir.fd(); |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 const ProcessFilter* filter) { | 917 const ProcessFilter* filter) { |
| 918 bool exited_cleanly = | 918 bool exited_cleanly = |
| 919 WaitForProcessesToExit(executable_name, wait_milliseconds, | 919 WaitForProcessesToExit(executable_name, wait_milliseconds, |
| 920 filter); | 920 filter); |
| 921 if (!exited_cleanly) | 921 if (!exited_cleanly) |
| 922 KillProcesses(executable_name, exit_code, filter); | 922 KillProcesses(executable_name, exit_code, filter); |
| 923 return exited_cleanly; | 923 return exited_cleanly; |
| 924 } | 924 } |
| 925 | 925 |
| 926 } // namespace base | 926 } // namespace base |
| OLD | NEW |