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

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

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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/process/kill_win.cc ('k') | base/process/process_posix.cc » ('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>
(...skipping 15 matching lines...) Expand all
26 #include "base/command_line.h" 26 #include "base/command_line.h"
27 #include "base/compiler_specific.h" 27 #include "base/compiler_specific.h"
28 #include "base/debug/debugger.h" 28 #include "base/debug/debugger.h"
29 #include "base/debug/stack_trace.h" 29 #include "base/debug/stack_trace.h"
30 #include "base/files/dir_reader_posix.h" 30 #include "base/files/dir_reader_posix.h"
31 #include "base/files/file_util.h" 31 #include "base/files/file_util.h"
32 #include "base/files/scoped_file.h" 32 #include "base/files/scoped_file.h"
33 #include "base/logging.h" 33 #include "base/logging.h"
34 #include "base/memory/scoped_ptr.h" 34 #include "base/memory/scoped_ptr.h"
35 #include "base/posix/eintr_wrapper.h" 35 #include "base/posix/eintr_wrapper.h"
36 #include "base/process/kill.h" 36 #include "base/process/process.h"
37 #include "base/process/process_metrics.h" 37 #include "base/process/process_metrics.h"
38 #include "base/strings/stringprintf.h" 38 #include "base/strings/stringprintf.h"
39 #include "base/synchronization/waitable_event.h" 39 #include "base/synchronization/waitable_event.h"
40 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" 40 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
41 #include "base/third_party/valgrind/valgrind.h" 41 #include "base/third_party/valgrind/valgrind.h"
42 #include "base/threading/platform_thread.h" 42 #include "base/threading/platform_thread.h"
43 #include "base/threading/thread_restrictions.h" 43 #include "base/threading/thread_restrictions.h"
44 #include "build/build_config.h" 44 #include "build/build_config.h"
45 45
46 #if defined(OS_LINUX) 46 #if defined(OS_LINUX)
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 std::min(output_buf_left, sizeof(buffer)))); 677 std::min(output_buf_left, sizeof(buffer))));
678 if (bytes_read <= 0) 678 if (bytes_read <= 0)
679 break; 679 break;
680 output->append(buffer, bytes_read); 680 output->append(buffer, bytes_read);
681 output_buf_left -= static_cast<size_t>(bytes_read); 681 output_buf_left -= static_cast<size_t>(bytes_read);
682 } 682 }
683 close(pipe_fd[0]); 683 close(pipe_fd[0]);
684 684
685 // Always wait for exit code (even if we know we'll declare 685 // Always wait for exit code (even if we know we'll declare
686 // GOT_MAX_OUTPUT). 686 // GOT_MAX_OUTPUT).
687 bool success = WaitForExitCode(pid, exit_code); 687 Process process(pid);
688 bool success = process.WaitForExit(exit_code);
688 689
689 // If we stopped because we read as much as we wanted, we return 690 // If we stopped because we read as much as we wanted, we return
690 // GOT_MAX_OUTPUT (because the child may exit due to |SIGPIPE|). 691 // GOT_MAX_OUTPUT (because the child may exit due to |SIGPIPE|).
691 if (!output_buf_left && bytes_read > 0) 692 if (!output_buf_left && bytes_read > 0)
692 return GOT_MAX_OUTPUT; 693 return GOT_MAX_OUTPUT;
693 else if (success) 694 else if (success)
694 return EXECUTE_SUCCESS; 695 return EXECUTE_SUCCESS;
695 return EXECUTE_FAILURE; 696 return EXECUTE_FAILURE;
696 } 697 }
697 } 698 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 jmp_buf env; 769 jmp_buf env;
769 if (setjmp(env) == 0) { 770 if (setjmp(env) == 0) {
770 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); 771 return CloneAndLongjmpInChild(flags, ptid, ctid, &env);
771 } 772 }
772 773
773 return 0; 774 return 0;
774 } 775 }
775 #endif // defined(OS_LINUX) 776 #endif // defined(OS_LINUX)
776 777
777 } // namespace base 778 } // namespace base
OLDNEW
« no previous file with comments | « base/process/kill_win.cc ('k') | base/process/process_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698