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_MACOS) | 8 #if defined(TARGET_OS_MACOS) |
7 | 9 |
8 #include "bin/process.h" | 10 #include "bin/process.h" |
9 | 11 |
10 #if !TARGET_OS_IOS | 12 #if !TARGET_OS_IOS |
11 #include <crt_externs.h> // NOLINT | 13 #include <crt_externs.h> // NOLINT |
12 #endif | 14 #endif |
13 #include <errno.h> // NOLINT | 15 #include <errno.h> // NOLINT |
14 #include <fcntl.h> // NOLINT | 16 #include <fcntl.h> // NOLINT |
15 #include <poll.h> // NOLINT | 17 #include <poll.h> // NOLINT |
16 #include <signal.h> // NOLINT | 18 #include <signal.h> // NOLINT |
17 #include <stdio.h> // NOLINT | 19 #include <stdio.h> // NOLINT |
18 #include <stdlib.h> // NOLINT | 20 #include <stdlib.h> // NOLINT |
19 #include <string.h> // NOLINT | 21 #include <string.h> // NOLINT |
20 #include <unistd.h> // NOLINT | 22 #include <unistd.h> // NOLINT |
21 | 23 |
22 #include "bin/dartutils.h" | 24 #include "bin/dartutils.h" |
23 #include "bin/fdutils.h" | 25 #include "bin/fdutils.h" |
24 #include "bin/lockers.h" | 26 #include "bin/lockers.h" |
25 #include "bin/log.h" | 27 #include "bin/log.h" |
26 #include "bin/thread.h" | 28 #include "bin/thread.h" |
27 | 29 |
28 #include "platform/signal_blocker.h" | 30 #include "platform/signal_blocker.h" |
29 #include "platform/utils.h" | 31 #include "platform/utils.h" |
30 | 32 |
31 namespace dart { | 33 namespace dart { |
32 namespace bin { | 34 namespace bin { |
33 | 35 |
| 36 int Process::global_exit_code_ = 0; |
| 37 Mutex* Process::global_exit_code_mutex_ = new Mutex(); |
| 38 |
34 // ProcessInfo is used to map a process id to the file descriptor for | 39 // ProcessInfo is used to map a process id to the file descriptor for |
35 // the pipe used to communicate the exit code of the process to Dart. | 40 // the pipe used to communicate the exit code of the process to Dart. |
36 // ProcessInfo objects are kept in the static singly-linked | 41 // ProcessInfo objects are kept in the static singly-linked |
37 // ProcessInfoList. | 42 // ProcessInfoList. |
38 class ProcessInfo { | 43 class ProcessInfo { |
39 public: | 44 public: |
40 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } | 45 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } |
41 ~ProcessInfo() { | 46 ~ProcessInfo() { |
42 int closed = TEMP_FAILURE_RETRY(close(fd_)); | 47 int closed = TEMP_FAILURE_RETRY(close(fd_)); |
43 if (closed != 0) { | 48 if (closed != 0) { |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 bzero(&act, sizeof(act)); | 1102 bzero(&act, sizeof(act)); |
1098 act.sa_handler = SIG_DFL; | 1103 act.sa_handler = SIG_DFL; |
1099 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 1104 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
1100 } | 1105 } |
1101 } | 1106 } |
1102 | 1107 |
1103 } // namespace bin | 1108 } // namespace bin |
1104 } // namespace dart | 1109 } // namespace dart |
1105 | 1110 |
1106 #endif // defined(TARGET_OS_MACOS) | 1111 #endif // defined(TARGET_OS_MACOS) |
| 1112 |
| 1113 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |