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

Side by Side Diff: runtime/bin/process_android.cc

Issue 1466523002: Landing patch set 7 from https://codereview.chromium.org/1450113003/ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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 | « runtime/bin/file_macos.cc ('k') | runtime/bin/process_linux.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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/process.h" 8 #include "bin/process.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
11 #include <fcntl.h> // NOLINT 11 #include <fcntl.h> // NOLINT
12 #include <poll.h> // NOLINT 12 #include <poll.h> // NOLINT
13 #include <stdio.h> // NOLINT 13 #include <stdio.h> // NOLINT
14 #include <stdlib.h> // NOLINT 14 #include <stdlib.h> // NOLINT
15 #include <string.h> // NOLINT 15 #include <string.h> // NOLINT
16 #include <sys/wait.h> // NOLINT 16 #include <sys/wait.h> // NOLINT
17 #include <unistd.h> // NOLINT 17 #include <unistd.h> // NOLINT
18 18
19 #include "bin/fdutils.h" 19 #include "bin/fdutils.h"
20 #include "bin/lockers.h" 20 #include "bin/lockers.h"
21 #include "bin/log.h" 21 #include "bin/log.h"
22 #include "bin/thread.h" 22 #include "bin/thread.h"
23 23
24 #include "platform/signal_blocker.h" 24 #include "platform/signal_blocker.h"
25 #include "platform/utils.h"
25 26
26 27
27 extern char **environ; 28 extern char **environ;
28 29
29 30
30 namespace dart { 31 namespace dart {
31 namespace bin { 32 namespace bin {
32 33
33 // ProcessInfo is used to map a process id to the file descriptor for 34 // ProcessInfo is used to map a process id to the file descriptor for
34 // the pipe used to communicate the exit code of the process to Dart. 35 // the pipe used to communicate the exit code of the process to Dart.
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 if (actual_errno == 0) actual_errno = EPERM; 638 if (actual_errno == 0) actual_errno = EPERM;
638 SetChildOsErrorMessage(); 639 SetChildOsErrorMessage();
639 CloseAllPipes(); 640 CloseAllPipes();
640 return actual_errno; 641 return actual_errno;
641 } 642 }
642 643
643 644
644 void SetChildOsErrorMessage() { 645 void SetChildOsErrorMessage() {
645 const int kBufferSize = 1024; 646 const int kBufferSize = 1024;
646 char error_message[kBufferSize]; 647 char error_message[kBufferSize];
647 strerror_r(errno, error_message, kBufferSize); 648 Utils::StrError(errno, error_message, kBufferSize);
648 *os_error_message_ = strdup(error_message); 649 *os_error_message_ = strdup(error_message);
649 } 650 }
650 651
651 652
652 void ReportChildError() { 653 void ReportChildError() {
653 // In the case of failure in the child process write the errno and 654 // In the case of failure in the child process write the errno and
654 // the OS error message to the exec control pipe and exit. 655 // the OS error message to the exec control pipe and exit.
655 int child_errno = errno; 656 int child_errno = errno;
656 const int kBufferSize = 1024; 657 const int kBufferSize = 1024;
657 char os_error_message[kBufferSize]; 658 char os_error_message[kBufferSize];
658 strerror_r(errno, os_error_message, kBufferSize); 659 Utils::StrError(errno, os_error_message, kBufferSize);
659 int bytes_written = 660 int bytes_written =
660 FDUtils::WriteToBlocking( 661 FDUtils::WriteToBlocking(
661 exec_control_[1], &child_errno, sizeof(child_errno)); 662 exec_control_[1], &child_errno, sizeof(child_errno));
662 if (bytes_written == sizeof(child_errno)) { 663 if (bytes_written == sizeof(child_errno)) {
663 FDUtils::WriteToBlocking( 664 FDUtils::WriteToBlocking(
664 exec_control_[1], os_error_message, strlen(os_error_message) + 1); 665 exec_control_[1], os_error_message, strlen(os_error_message) + 1);
665 } 666 }
666 VOID_TEMP_FAILURE_RETRY(close(exec_control_[1])); 667 VOID_TEMP_FAILURE_RETRY(close(exec_control_[1]));
667 exit(1); 668 exit(1);
668 } 669 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 bzero(&act, sizeof(act)); 999 bzero(&act, sizeof(act));
999 act.sa_handler = SIG_DFL; 1000 act.sa_handler = SIG_DFL;
1000 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); 1001 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL));
1001 } 1002 }
1002 } 1003 }
1003 1004
1004 } // namespace bin 1005 } // namespace bin
1005 } // namespace dart 1006 } // namespace dart
1006 1007
1007 #endif // defined(TARGET_OS_ANDROID) 1008 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/file_macos.cc ('k') | runtime/bin/process_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698