| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 for (int i = 0; i < kSignalsCount; i++) { | 703 for (int i = 0; i < kSignalsCount; i++) { |
| 704 sigaddset(&act.sa_mask, kSignals[i]); | 704 sigaddset(&act.sa_mask, kSignals[i]); |
| 705 } | 705 } |
| 706 int status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 706 int status = NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 707 if (status < 0) { | 707 if (status < 0) { |
| 708 VOID_TEMP_FAILURE_RETRY(close(fds[0])); | 708 VOID_TEMP_FAILURE_RETRY(close(fds[0])); |
| 709 VOID_TEMP_FAILURE_RETRY(close(fds[1])); | 709 VOID_TEMP_FAILURE_RETRY(close(fds[1])); |
| 710 return -1; | 710 return -1; |
| 711 } | 711 } |
| 712 } | 712 } |
| 713 if (signal_handlers == NULL) { | 713 signal_handlers = new SignalInfo(fds[1], signal, signal_handlers); |
| 714 signal_handlers = new SignalInfo(fds[1], signal); | |
| 715 } else { | |
| 716 new SignalInfo(fds[1], signal, signal_handlers); | |
| 717 } | |
| 718 return fds[0]; | 714 return fds[0]; |
| 719 } | 715 } |
| 720 | 716 |
| 721 | 717 |
| 722 void Process::ClearSignalHandler(intptr_t signal) { | 718 void Process::ClearSignalHandler(intptr_t signal) { |
| 723 ThreadSignalBlocker blocker(kSignalsCount, kSignals); | 719 ThreadSignalBlocker blocker(kSignalsCount, kSignals); |
| 724 MutexLocker lock(signal_mutex); | 720 MutexLocker lock(signal_mutex); |
| 725 SignalInfo* handler = signal_handlers; | 721 SignalInfo* handler = signal_handlers; |
| 726 bool unlisten = true; | 722 bool unlisten = true; |
| 727 while (handler != NULL) { | 723 while (handler != NULL) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 744 bzero(&act, sizeof(act)); | 740 bzero(&act, sizeof(act)); |
| 745 act.sa_handler = SIG_DFL; | 741 act.sa_handler = SIG_DFL; |
| 746 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 742 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 747 } | 743 } |
| 748 } | 744 } |
| 749 | 745 |
| 750 } // namespace bin | 746 } // namespace bin |
| 751 } // namespace dart | 747 } // namespace dart |
| 752 | 748 |
| 753 #endif // defined(TARGET_OS_ANDROID) | 749 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |