| 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 #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 |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 intptr_t Process::SetSignalHandler(intptr_t signal) { | 668 intptr_t Process::SetSignalHandler(intptr_t signal) { |
| 669 bool found = false; | 669 bool found = false; |
| 670 for (int i = 0; i < kSignalsCount; i++) { | 670 for (int i = 0; i < kSignalsCount; i++) { |
| 671 if (kSignals[i] == signal) { | 671 if (kSignals[i] == signal) { |
| 672 found = true; | 672 found = true; |
| 673 break; | 673 break; |
| 674 } | 674 } |
| 675 } | 675 } |
| 676 if (!found) return -1; | 676 if (!found) return -1; |
| 677 int fds[2]; | 677 int fds[2]; |
| 678 if (NO_RETRY_EXPECTED(pipe(fds)) != 0) { | 678 if (NO_RETRY_EXPECTED(pipe2(fds, O_CLOEXEC)) != 0) { |
| 679 return -1; | 679 return -1; |
| 680 } | 680 } |
| 681 if (!FDUtils::SetNonBlocking(fds[0])) { | 681 if (!FDUtils::SetNonBlocking(fds[0])) { |
| 682 VOID_TEMP_FAILURE_RETRY(close(fds[0])); | 682 VOID_TEMP_FAILURE_RETRY(close(fds[0])); |
| 683 VOID_TEMP_FAILURE_RETRY(close(fds[1])); | 683 VOID_TEMP_FAILURE_RETRY(close(fds[1])); |
| 684 return -1; | 684 return -1; |
| 685 } | 685 } |
| 686 ThreadSignalBlocker blocker(kSignalsCount, kSignals); | 686 ThreadSignalBlocker blocker(kSignalsCount, kSignals); |
| 687 MutexLocker lock(signal_mutex); | 687 MutexLocker lock(signal_mutex); |
| 688 SignalInfo* handler = signal_handlers; | 688 SignalInfo* handler = signal_handlers; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 bzero(&act, sizeof(act)); | 743 bzero(&act, sizeof(act)); |
| 744 act.sa_handler = SIG_DFL; | 744 act.sa_handler = SIG_DFL; |
| 745 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 745 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace bin | 749 } // namespace bin |
| 750 } // namespace dart | 750 } // namespace dart |
| 751 | 751 |
| 752 #endif // defined(TARGET_OS_ANDROID) | 752 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |