| 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_LINUX) | 8 #if defined(TARGET_OS_LINUX) |
| 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" |
| 26 |
| 24 #include "platform/signal_blocker.h" | 27 #include "platform/signal_blocker.h" |
| 25 #include "platform/utils.h" | 28 #include "platform/utils.h" |
| 26 | 29 |
| 27 extern char **environ; | 30 extern char **environ; |
| 28 | 31 |
| 29 namespace dart { | 32 namespace dart { |
| 30 namespace bin { | 33 namespace bin { |
| 31 | 34 |
| 35 int Process::global_exit_code_ = 0; |
| 36 Mutex* Process::global_exit_code_mutex_ = new Mutex(); |
| 37 |
| 32 // 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 |
| 33 // 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. |
| 34 // ProcessInfo objects are kept in the static singly-linked | 40 // ProcessInfo objects are kept in the static singly-linked |
| 35 // ProcessInfoList. | 41 // ProcessInfoList. |
| 36 class ProcessInfo { | 42 class ProcessInfo { |
| 37 public: | 43 public: |
| 38 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } | 44 ProcessInfo(pid_t pid, intptr_t fd) : pid_(pid), fd_(fd) { } |
| 39 ~ProcessInfo() { | 45 ~ProcessInfo() { |
| 40 int closed = TEMP_FAILURE_RETRY(close(fd_)); | 46 int closed = TEMP_FAILURE_RETRY(close(fd_)); |
| 41 if (closed != 0) { | 47 if (closed != 0) { |
| (...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 bzero(&act, sizeof(act)); | 1031 bzero(&act, sizeof(act)); |
| 1026 act.sa_handler = SIG_DFL; | 1032 act.sa_handler = SIG_DFL; |
| 1027 sigaction(signal, &act, NULL); | 1033 sigaction(signal, &act, NULL); |
| 1028 } | 1034 } |
| 1029 } | 1035 } |
| 1030 | 1036 |
| 1031 } // namespace bin | 1037 } // namespace bin |
| 1032 } // namespace dart | 1038 } // namespace dart |
| 1033 | 1039 |
| 1034 #endif // defined(TARGET_OS_LINUX) | 1040 #endif // defined(TARGET_OS_LINUX) |
| 1041 |
| 1042 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |