Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: base/process/launch_posix.cc

Issue 1331973002: Remove clang type profiler and deep memory profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/base.gypi ('k') | build/common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/process/launch.h" 5 #include "base/process/launch.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sched.h> 10 #include <sched.h>
11 #include <setjmp.h> 11 #include <setjmp.h>
12 #include <signal.h> 12 #include <signal.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <sys/resource.h> 14 #include <sys/resource.h>
15 #include <sys/syscall.h> 15 #include <sys/syscall.h>
16 #include <sys/time.h> 16 #include <sys/time.h>
17 #include <sys/types.h> 17 #include <sys/types.h>
18 #include <sys/wait.h> 18 #include <sys/wait.h>
19 #include <unistd.h> 19 #include <unistd.h>
20 20
21 #include <iterator> 21 #include <iterator>
22 #include <limits> 22 #include <limits>
23 #include <set> 23 #include <set>
24 24
25 #include "base/allocator/type_profiler_control.h"
26 #include "base/command_line.h" 25 #include "base/command_line.h"
27 #include "base/compiler_specific.h" 26 #include "base/compiler_specific.h"
28 #include "base/debug/debugger.h" 27 #include "base/debug/debugger.h"
29 #include "base/debug/stack_trace.h" 28 #include "base/debug/stack_trace.h"
30 #include "base/files/dir_reader_posix.h" 29 #include "base/files/dir_reader_posix.h"
31 #include "base/files/file_util.h" 30 #include "base/files/file_util.h"
32 #include "base/files/scoped_file.h" 31 #include "base/files/scoped_file.h"
33 #include "base/logging.h" 32 #include "base/logging.h"
34 #include "base/memory/scoped_ptr.h" 33 #include "base/memory/scoped_ptr.h"
35 #include "base/posix/eintr_wrapper.h" 34 #include "base/posix/eintr_wrapper.h"
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 384
386 if (options.new_process_group) { 385 if (options.new_process_group) {
387 // Instead of inheriting the process group ID of the parent, the child 386 // Instead of inheriting the process group ID of the parent, the child
388 // starts off a new process group with pgid equal to its process ID. 387 // starts off a new process group with pgid equal to its process ID.
389 if (setpgid(0, 0) < 0) { 388 if (setpgid(0, 0) < 0) {
390 RAW_LOG(ERROR, "setpgid failed"); 389 RAW_LOG(ERROR, "setpgid failed");
391 _exit(127); 390 _exit(127);
392 } 391 }
393 } 392 }
394 393
395 // Stop type-profiler.
396 // The profiler should be stopped between fork and exec since it inserts
397 // locks at new/delete expressions. See http://crbug.com/36678.
398 base::type_profiler::Controller::Stop();
399
400 if (options.maximize_rlimits) { 394 if (options.maximize_rlimits) {
401 // Some resource limits need to be maximal in this child. 395 // Some resource limits need to be maximal in this child.
402 for (size_t i = 0; i < options.maximize_rlimits->size(); ++i) { 396 for (size_t i = 0; i < options.maximize_rlimits->size(); ++i) {
403 const int resource = (*options.maximize_rlimits)[i]; 397 const int resource = (*options.maximize_rlimits)[i];
404 struct rlimit limit; 398 struct rlimit limit;
405 if (getrlimit(resource, &limit) < 0) { 399 if (getrlimit(resource, &limit) < 0) {
406 RAW_LOG(WARNING, "getrlimit failed"); 400 RAW_LOG(WARNING, "getrlimit failed");
407 } else if (limit.rlim_cur < limit.rlim_max) { 401 } else if (limit.rlim_cur < limit.rlim_max) {
408 limit.rlim_cur = limit.rlim_max; 402 limit.rlim_cur = limit.rlim_max;
409 if (setrlimit(resource, &limit) < 0) { 403 if (setrlimit(resource, &limit) < 0) {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 580
587 // Obscure fork() rule: in the child, if you don't end up doing exec*(), 581 // Obscure fork() rule: in the child, if you don't end up doing exec*(),
588 // you call _exit() instead of exit(). This is because _exit() does not 582 // you call _exit() instead of exit(). This is because _exit() does not
589 // call any previously-registered (in the parent) exit handlers, which 583 // call any previously-registered (in the parent) exit handlers, which
590 // might do things like block waiting for threads that don't even exist 584 // might do things like block waiting for threads that don't even exist
591 // in the child. 585 // in the child.
592 int dev_null = open("/dev/null", O_WRONLY); 586 int dev_null = open("/dev/null", O_WRONLY);
593 if (dev_null < 0) 587 if (dev_null < 0)
594 _exit(127); 588 _exit(127);
595 589
596 // Stop type-profiler.
597 // The profiler should be stopped between fork and exec since it inserts
598 // locks at new/delete expressions. See http://crbug.com/36678.
599 base::type_profiler::Controller::Stop();
600
601 fd_shuffle1.push_back(InjectionArc(pipe_fd[1], STDOUT_FILENO, true)); 590 fd_shuffle1.push_back(InjectionArc(pipe_fd[1], STDOUT_FILENO, true));
602 fd_shuffle1.push_back(InjectionArc( 591 fd_shuffle1.push_back(InjectionArc(
603 include_stderr ? pipe_fd[1] : dev_null, 592 include_stderr ? pipe_fd[1] : dev_null,
604 STDERR_FILENO, true)); 593 STDERR_FILENO, true));
605 fd_shuffle1.push_back(InjectionArc(dev_null, STDIN_FILENO, true)); 594 fd_shuffle1.push_back(InjectionArc(dev_null, STDIN_FILENO, true));
606 // Adding another element here? Remeber to increase the argument to 595 // Adding another element here? Remeber to increase the argument to
607 // reserve(), above. 596 // reserve(), above.
608 597
609 for (size_t i = 0; i < fd_shuffle1.size(); ++i) 598 for (size_t i = 0; i < fd_shuffle1.size(); ++i)
610 fd_shuffle2.push_back(fd_shuffle1[i]); 599 fd_shuffle2.push_back(fd_shuffle1[i]);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 jmp_buf env; 783 jmp_buf env;
795 if (setjmp(env) == 0) { 784 if (setjmp(env) == 0) {
796 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); 785 return CloneAndLongjmpInChild(flags, ptid, ctid, &env);
797 } 786 }
798 787
799 return 0; 788 return 0;
800 } 789 }
801 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI) 790 #endif // defined(OS_LINUX) || defined(OS_NACL_NONSFI)
802 791
803 } // namespace base 792 } // namespace base
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698