| 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_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 intptr_t Process::SetSignalHandler(intptr_t signal) { | 664 intptr_t Process::SetSignalHandler(intptr_t signal) { |
| 665 bool found = false; | 665 bool found = false; |
| 666 for (int i = 0; i < kSignalsCount; i++) { | 666 for (int i = 0; i < kSignalsCount; i++) { |
| 667 if (kSignals[i] == signal) { | 667 if (kSignals[i] == signal) { |
| 668 found = true; | 668 found = true; |
| 669 break; | 669 break; |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 if (!found) return -1; | 672 if (!found) return -1; |
| 673 int fds[2]; | 673 int fds[2]; |
| 674 if (pipe(fds) != 0) { | 674 if (NO_RETRY_EXPECTED(pipe2(fds, O_CLOEXEC)) != 0) { |
| 675 return -1; | 675 return -1; |
| 676 } | 676 } |
| 677 ThreadSignalBlocker blocker(kSignalsCount, kSignals); | 677 ThreadSignalBlocker blocker(kSignalsCount, kSignals); |
| 678 MutexLocker lock(signal_mutex); | 678 MutexLocker lock(signal_mutex); |
| 679 SignalInfo* handler = signal_handlers; | 679 SignalInfo* handler = signal_handlers; |
| 680 bool listen = true; | 680 bool listen = true; |
| 681 while (handler != NULL) { | 681 while (handler != NULL) { |
| 682 if (handler->signal() == signal) { | 682 if (handler->signal() == signal) { |
| 683 listen = false; | 683 listen = false; |
| 684 break; | 684 break; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 bzero(&act, sizeof(act)); | 736 bzero(&act, sizeof(act)); |
| 737 act.sa_handler = SIG_DFL; | 737 act.sa_handler = SIG_DFL; |
| 738 sigaction(signal, &act, NULL); | 738 sigaction(signal, &act, NULL); |
| 739 } | 739 } |
| 740 } | 740 } |
| 741 | 741 |
| 742 } // namespace bin | 742 } // namespace bin |
| 743 } // namespace dart | 743 } // namespace dart |
| 744 | 744 |
| 745 #endif // defined(TARGET_OS_LINUX) | 745 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |