| OLD | NEW |
| 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 #if !defined(DART_IO_DISABLED) |
| 6 |
| 5 #include "platform/globals.h" | 7 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
| 7 | 9 |
| 8 #include "bin/process.h" | 10 #include "bin/process.h" |
| 9 | 11 |
| 10 #include <errno.h> // NOLINT | 12 #include <errno.h> // NOLINT |
| 11 #include <fcntl.h> // NOLINT | 13 #include <fcntl.h> // NOLINT |
| 12 #include <poll.h> // NOLINT | 14 #include <poll.h> // NOLINT |
| 13 #include <stdio.h> // NOLINT | 15 #include <stdio.h> // NOLINT |
| 14 #include <stdlib.h> // NOLINT | 16 #include <stdlib.h> // NOLINT |
| 15 #include <string.h> // NOLINT | 17 #include <string.h> // NOLINT |
| 16 #include <sys/wait.h> // NOLINT | 18 #include <sys/wait.h> // NOLINT |
| 17 #include <unistd.h> // NOLINT | 19 #include <unistd.h> // NOLINT |
| 18 | 20 |
| 19 #include "bin/dartutils.h" | 21 #include "bin/dartutils.h" |
| 20 #include "bin/fdutils.h" | 22 #include "bin/fdutils.h" |
| 21 #include "bin/lockers.h" | 23 #include "bin/lockers.h" |
| 22 #include "bin/log.h" | 24 #include "bin/log.h" |
| 23 #include "bin/thread.h" | 25 #include "bin/thread.h" |
| 24 | 26 |
| 25 #include "platform/signal_blocker.h" | 27 #include "platform/signal_blocker.h" |
| 26 #include "platform/utils.h" | 28 #include "platform/utils.h" |
| 27 | 29 |
| 28 extern char **environ; | 30 extern char **environ; |
| 29 | 31 |
| 30 namespace dart { | 32 namespace dart { |
| 31 namespace bin { | 33 namespace bin { |
| 32 | 34 |
| 35 int Process::global_exit_code_ = 0; |
| 36 Mutex* Process::global_exit_code_mutex_ = new Mutex(); |
| 37 |
| 33 // ProcessInfo is used to map a process id to the file descriptor for | 38 // 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. | 39 // the pipe used to communicate the exit code of the process to Dart. |
| 35 // ProcessInfo objects are kept in the static singly-linked | 40 // ProcessInfo objects are kept in the static singly-linked |
| 36 // ProcessInfoList. | 41 // ProcessInfoList. |
| 37 class ProcessInfo { | 42 class ProcessInfo { |
| 38 public: | 43 public: |
| 39 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } | 44 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } |
| 40 ~ProcessInfo() { | 45 ~ProcessInfo() { |
| 41 int closed = TEMP_FAILURE_RETRY(close(fd_)); | 46 int closed = TEMP_FAILURE_RETRY(close(fd_)); |
| 42 if (closed != 0) { | 47 if (closed != 0) { |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 bzero(&act, sizeof(act)); | 1035 bzero(&act, sizeof(act)); |
| 1031 act.sa_handler = SIG_DFL; | 1036 act.sa_handler = SIG_DFL; |
| 1032 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 1037 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 1033 } | 1038 } |
| 1034 } | 1039 } |
| 1035 | 1040 |
| 1036 } // namespace bin | 1041 } // namespace bin |
| 1037 } // namespace dart | 1042 } // namespace dart |
| 1038 | 1043 |
| 1039 #endif // defined(TARGET_OS_ANDROID) | 1044 #endif // defined(TARGET_OS_ANDROID) |
| 1045 |
| 1046 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |