| 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 <dirent.h> | 5 #include <dirent.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <sys/resource.h> | 7 #include <sys/resource.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 #include <sys/time.h> | 9 #include <sys/time.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 void LogSandboxStarted(const std::string& sandbox_name) { | 54 void LogSandboxStarted(const std::string& sandbox_name) { |
| 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 56 const std::string process_type = | 56 const std::string process_type = |
| 57 command_line.GetSwitchValueASCII(switches::kProcessType); | 57 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 58 const std::string activated_sandbox = | 58 const std::string activated_sandbox = |
| 59 "Activated " + sandbox_name + " sandbox for process type: " + | 59 "Activated " + sandbox_name + " sandbox for process type: " + |
| 60 process_type + "."; | 60 process_type + "."; |
| 61 #if defined(OS_CHROMEOS) | |
| 62 LOG(WARNING) << activated_sandbox; | |
| 63 #else | |
| 64 VLOG(1) << activated_sandbox; | 61 VLOG(1) << activated_sandbox; |
| 65 #endif | |
| 66 } | 62 } |
| 67 | 63 |
| 68 #if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) | 64 #if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) |
| 69 bool AddResourceLimit(int resource, rlim_t limit) { | 65 bool AddResourceLimit(int resource, rlim_t limit) { |
| 70 struct rlimit old_rlimit; | 66 struct rlimit old_rlimit; |
| 71 if (getrlimit(resource, &old_rlimit)) | 67 if (getrlimit(resource, &old_rlimit)) |
| 72 return false; | 68 return false; |
| 73 // Make sure we don't raise the existing limit. | 69 // Make sure we don't raise the existing limit. |
| 74 const struct rlimit new_rlimit = { | 70 const struct rlimit new_rlimit = { |
| 75 std::min(old_rlimit.rlim_cur, limit), | 71 std::min(old_rlimit.rlim_cur, limit), |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 | 406 |
| 411 void LinuxSandbox::StopThreadAndEnsureNotCounted(base::Thread* thread) const { | 407 void LinuxSandbox::StopThreadAndEnsureNotCounted(base::Thread* thread) const { |
| 412 DCHECK(thread); | 408 DCHECK(thread); |
| 413 base::ScopedFD proc_self_task(OpenProcTaskFd(proc_fd_)); | 409 base::ScopedFD proc_self_task(OpenProcTaskFd(proc_fd_)); |
| 414 PCHECK(proc_self_task.is_valid()); | 410 PCHECK(proc_self_task.is_valid()); |
| 415 CHECK(sandbox::ThreadHelpers::StopThreadAndWatchProcFS(proc_self_task.get(), | 411 CHECK(sandbox::ThreadHelpers::StopThreadAndWatchProcFS(proc_self_task.get(), |
| 416 thread)); | 412 thread)); |
| 417 } | 413 } |
| 418 | 414 |
| 419 } // namespace content | 415 } // namespace content |
| OLD | NEW |