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 "content/browser/zygote_host/zygote_host_impl_linux.h" | 5 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
426 if (IsHeapProfilerRunning()) | 426 if (IsHeapProfilerRunning()) |
427 return; | 427 return; |
428 #endif | 428 #endif |
429 std::vector<std::string> adj_oom_score_cmdline; | 429 std::vector<std::string> adj_oom_score_cmdline; |
430 adj_oom_score_cmdline.push_back(sandbox_binary_); | 430 adj_oom_score_cmdline.push_back(sandbox_binary_); |
431 adj_oom_score_cmdline.push_back(sandbox::kAdjustOOMScoreSwitch); | 431 adj_oom_score_cmdline.push_back(sandbox::kAdjustOOMScoreSwitch); |
432 adj_oom_score_cmdline.push_back(base::Int64ToString(pid)); | 432 adj_oom_score_cmdline.push_back(base::Int64ToString(pid)); |
433 adj_oom_score_cmdline.push_back(base::IntToString(score)); | 433 adj_oom_score_cmdline.push_back(base::IntToString(score)); |
434 | 434 |
435 base::ProcessHandle sandbox_helper_process; | 435 base::ProcessHandle sandbox_helper_process; |
436 if (base::LaunchProcess(adj_oom_score_cmdline, base::LaunchOptions(), | 436 base::LaunchOptions options; |
437 options.allow_new_privs = true; | |
jln (very slow on Chromium)
2014/04/24 00:17:59
Please add a comment along the lines of "sandbox_h
| |
438 if (base::LaunchProcess(adj_oom_score_cmdline, options, | |
437 &sandbox_helper_process)) { | 439 &sandbox_helper_process)) { |
438 base::EnsureProcessGetsReaped(sandbox_helper_process); | 440 base::EnsureProcessGetsReaped(sandbox_helper_process); |
439 } | 441 } |
440 } else if (!using_suid_sandbox_) { | 442 } else if (!using_suid_sandbox_) { |
441 if (!base::AdjustOOMScore(pid, score)) | 443 if (!base::AdjustOOMScore(pid, score)) |
442 PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid; | 444 PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid; |
443 } | 445 } |
444 } | 446 } |
445 #endif | 447 #endif |
446 | 448 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 status = tmp_status; | 500 status = tmp_status; |
499 } | 501 } |
500 } | 502 } |
501 | 503 |
502 if (status != base::TERMINATION_STATUS_STILL_RUNNING) { | 504 if (status != base::TERMINATION_STATUS_STILL_RUNNING) { |
503 ZygoteChildDied(handle); | 505 ZygoteChildDied(handle); |
504 } | 506 } |
505 return static_cast<base::TerminationStatus>(status); | 507 return static_cast<base::TerminationStatus>(status); |
506 } | 508 } |
507 | 509 |
510 bool ZygoteHostImpl::UsingSUIDSandbox() const { | |
511 return using_suid_sandbox_; | |
512 } | |
513 | |
508 pid_t ZygoteHostImpl::GetPid() const { | 514 pid_t ZygoteHostImpl::GetPid() const { |
509 return pid_; | 515 return pid_; |
510 } | 516 } |
511 | 517 |
512 pid_t ZygoteHostImpl::GetSandboxHelperPid() const { | 518 pid_t ZygoteHostImpl::GetSandboxHelperPid() const { |
513 return RenderSandboxHostLinux::GetInstance()->pid(); | 519 return RenderSandboxHostLinux::GetInstance()->pid(); |
514 } | 520 } |
515 | 521 |
516 int ZygoteHostImpl::GetSandboxStatus() const { | 522 int ZygoteHostImpl::GetSandboxStatus() const { |
517 if (have_read_sandbox_status_word_) | 523 if (have_read_sandbox_status_word_) |
518 return sandbox_status_; | 524 return sandbox_status_; |
519 return 0; | 525 return 0; |
520 } | 526 } |
521 | 527 |
522 } // namespace content | 528 } // namespace content |
OLD | NEW |