| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 696 } |
| 697 int status = sigaction(signal, &act, NULL); | 697 int status = sigaction(signal, &act, NULL); |
| 698 if (status < 0) { | 698 if (status < 0) { |
| 699 int err = errno; | 699 int err = errno; |
| 700 VOID_TEMP_FAILURE_RETRY(close(fds[0])); | 700 VOID_TEMP_FAILURE_RETRY(close(fds[0])); |
| 701 VOID_TEMP_FAILURE_RETRY(close(fds[1])); | 701 VOID_TEMP_FAILURE_RETRY(close(fds[1])); |
| 702 errno = err; | 702 errno = err; |
| 703 return -1; | 703 return -1; |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 if (signal_handlers == NULL) { | 706 signal_handlers = new SignalInfo(fds[1], signal, signal_handlers); |
| 707 signal_handlers = new SignalInfo(fds[1], signal); | |
| 708 } else { | |
| 709 new SignalInfo(fds[1], signal, signal_handlers); | |
| 710 } | |
| 711 return fds[0]; | 707 return fds[0]; |
| 712 } | 708 } |
| 713 | 709 |
| 714 | 710 |
| 715 void Process::ClearSignalHandler(intptr_t signal) { | 711 void Process::ClearSignalHandler(intptr_t signal) { |
| 716 ThreadSignalBlocker blocker(kSignalsCount, kSignals); | 712 ThreadSignalBlocker blocker(kSignalsCount, kSignals); |
| 717 MutexLocker lock(signal_mutex); | 713 MutexLocker lock(signal_mutex); |
| 718 SignalInfo* handler = signal_handlers; | 714 SignalInfo* handler = signal_handlers; |
| 719 bool unlisten = true; | 715 bool unlisten = true; |
| 720 while (handler != NULL) { | 716 while (handler != NULL) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 737 bzero(&act, sizeof(act)); | 733 bzero(&act, sizeof(act)); |
| 738 act.sa_handler = SIG_DFL; | 734 act.sa_handler = SIG_DFL; |
| 739 sigaction(signal, &act, NULL); | 735 sigaction(signal, &act, NULL); |
| 740 } | 736 } |
| 741 } | 737 } |
| 742 | 738 |
| 743 } // namespace bin | 739 } // namespace bin |
| 744 } // namespace dart | 740 } // namespace dart |
| 745 | 741 |
| 746 #endif // defined(TARGET_OS_LINUX) | 742 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |