| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #include "vm/simulator.h" | 6 #include "vm/simulator.h" |
| 7 #include "vm/signal_handler.h" | 7 #include "vm/signal_handler.h" |
| 8 #if defined(TARGET_OS_MACOS) | 8 #if defined(TARGET_OS_MACOS) |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 #elif defined(TARGET_ARCH_MIPS) | 95 #elif defined(TARGET_ARCH_MIPS) |
| 96 lr = 0; | 96 lr = 0; |
| 97 #else | 97 #else |
| 98 UNIMPLEMENTED(); | 98 UNIMPLEMENTED(); |
| 99 #endif // TARGET_ARCH_... | 99 #endif // TARGET_ARCH_... |
| 100 | 100 |
| 101 return lr; | 101 return lr; |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 void SignalHandler::Install(SignalAction action) { | 105 void SignalHandler::InstallImpl(SignalAction action) { |
| 106 struct sigaction act; | 106 struct sigaction act; |
| 107 act.sa_handler = NULL; | 107 act.sa_handler = NULL; |
| 108 act.sa_sigaction = action; | 108 act.sa_sigaction = action; |
| 109 sigemptyset(&act.sa_mask); | 109 sigemptyset(&act.sa_mask); |
| 110 act.sa_flags = SA_RESTART | SA_SIGINFO; | 110 act.sa_flags = SA_RESTART | SA_SIGINFO; |
| 111 int r = sigaction(SIGPROF, &act, NULL); | 111 int r = sigaction(SIGPROF, &act, NULL); |
| 112 ASSERT(r == 0); | 112 ASSERT(r == 0); |
| 113 } | 113 } |
| 114 | 114 |
| 115 | 115 |
| 116 void SignalHandler::Remove() { | 116 void SignalHandler::Remove() { |
| 117 // Ignore future SIGPROF signals because by default SIGPROF will terminate | 117 // Ignore future SIGPROF signals because by default SIGPROF will terminate |
| 118 // the process and we may have some signals in flight. | 118 // the process and we may have some signals in flight. |
| 119 struct sigaction act; | 119 struct sigaction act; |
| 120 act.sa_handler = SIG_IGN; | 120 act.sa_handler = SIG_IGN; |
| 121 sigemptyset(&act.sa_mask); | 121 sigemptyset(&act.sa_mask); |
| 122 act.sa_flags = 0; | 122 act.sa_flags = 0; |
| 123 int r = sigaction(SIGPROF, &act, NULL); | 123 int r = sigaction(SIGPROF, &act, NULL); |
| 124 ASSERT(r == 0); | 124 ASSERT(r == 0); |
| 125 } | 125 } |
| 126 | 126 |
| 127 | 127 |
| 128 } // namespace dart | 128 } // namespace dart |
| 129 | 129 |
| 130 #endif // defined(TARGET_OS_MACOS) | 130 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |