| 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 if (handler->signal() == signal) { | 732 if (handler->signal() == signal) { |
| 733 listen = false; | 733 listen = false; |
| 734 break; | 734 break; |
| 735 } | 735 } |
| 736 handler = handler->next(); | 736 handler = handler->next(); |
| 737 } | 737 } |
| 738 if (listen) { | 738 if (listen) { |
| 739 struct sigaction act; | 739 struct sigaction act; |
| 740 bzero(&act, sizeof(act)); | 740 bzero(&act, sizeof(act)); |
| 741 act.sa_handler = SignalHandler; | 741 act.sa_handler = SignalHandler; |
| 742 sigemptyset(&act.sa_mask); |
| 743 for (int i = 0; i < kSignalsCount; i++) { |
| 744 sigaddset(&act.sa_mask, kSignals[i]); |
| 745 } |
| 742 int status = TEMP_FAILURE_RETRY_BLOCK_SIGNALS( | 746 int status = TEMP_FAILURE_RETRY_BLOCK_SIGNALS( |
| 743 sigaction(signal, &act, NULL)); | 747 sigaction(signal, &act, NULL)); |
| 744 if (status < 0) { | 748 if (status < 0) { |
| 745 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[0])); | 749 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[0])); |
| 746 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[1])); | 750 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(close(fds[1])); |
| 747 return -1; | 751 return -1; |
| 748 } | 752 } |
| 749 } | 753 } |
| 750 if (signal_handlers == NULL) { | 754 if (signal_handlers == NULL) { |
| 751 signal_handlers = new SignalInfo(fds[1], signal); | 755 signal_handlers = new SignalInfo(fds[1], signal); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 bzero(&act, sizeof(act)); | 787 bzero(&act, sizeof(act)); |
| 784 act.sa_handler = SIG_DFL; | 788 act.sa_handler = SIG_DFL; |
| 785 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL)); | 789 VOID_TEMP_FAILURE_RETRY_BLOCK_SIGNALS(sigaction(signal, &act, NULL)); |
| 786 } | 790 } |
| 787 } | 791 } |
| 788 | 792 |
| 789 } // namespace bin | 793 } // namespace bin |
| 790 } // namespace dart | 794 } // namespace dart |
| 791 | 795 |
| 792 #endif // defined(TARGET_OS_MACOS) | 796 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |