| 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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 if (kSignals[i] == signal) { | 715 if (kSignals[i] == signal) { |
| 716 found = true; | 716 found = true; |
| 717 break; | 717 break; |
| 718 } | 718 } |
| 719 } | 719 } |
| 720 if (!found) return -1; | 720 if (!found) return -1; |
| 721 int fds[2]; | 721 int fds[2]; |
| 722 if (NO_RETRY_EXPECTED(pipe(fds)) != 0) { | 722 if (NO_RETRY_EXPECTED(pipe(fds)) != 0) { |
| 723 return -1; | 723 return -1; |
| 724 } | 724 } |
| 725 if (!FDUtils::SetNonBlocking(fds[0])) { | 725 if (!FDUtils::SetCloseOnExec(fds[0]) || |
| 726 !FDUtils::SetCloseOnExec(fds[1]) || |
| 727 !FDUtils::SetNonBlocking(fds[0])) { |
| 726 VOID_TEMP_FAILURE_RETRY(close(fds[0])); | 728 VOID_TEMP_FAILURE_RETRY(close(fds[0])); |
| 727 VOID_TEMP_FAILURE_RETRY(close(fds[1])); | 729 VOID_TEMP_FAILURE_RETRY(close(fds[1])); |
| 728 return -1; | 730 return -1; |
| 729 } | 731 } |
| 730 ThreadSignalBlocker blocker(kSignalsCount, kSignals); | 732 ThreadSignalBlocker blocker(kSignalsCount, kSignals); |
| 731 MutexLocker lock(signal_mutex); | 733 MutexLocker lock(signal_mutex); |
| 732 SignalInfo* handler = signal_handlers; | 734 SignalInfo* handler = signal_handlers; |
| 733 bool listen = true; | 735 bool listen = true; |
| 734 while (handler != NULL) { | 736 while (handler != NULL) { |
| 735 if (handler->signal() == signal) { | 737 if (handler->signal() == signal) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 bzero(&act, sizeof(act)); | 791 bzero(&act, sizeof(act)); |
| 790 act.sa_handler = SIG_DFL; | 792 act.sa_handler = SIG_DFL; |
| 791 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); | 793 VOID_NO_RETRY_EXPECTED(sigaction(signal, &act, NULL)); |
| 792 } | 794 } |
| 793 } | 795 } |
| 794 | 796 |
| 795 } // namespace bin | 797 } // namespace bin |
| 796 } // namespace dart | 798 } // namespace dart |
| 797 | 799 |
| 798 #endif // defined(TARGET_OS_MACOS) | 800 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |