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_ANDROID) | 8 #if defined(TARGET_OS_ANDROID) |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 UNIMPLEMENTED(); | 77 UNIMPLEMENTED(); |
78 #endif // TARGET_ARCH_... | 78 #endif // TARGET_ARCH_... |
79 return lr; | 79 return lr; |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 void SignalHandler::Install(SignalAction action) { | 83 void SignalHandler::Install(SignalAction action) { |
84 struct sigaction act; | 84 struct sigaction act; |
85 memset(&act, 0, sizeof(act)); | 85 memset(&act, 0, sizeof(act)); |
86 act.sa_sigaction = action; | 86 act.sa_sigaction = action; |
87 sigemptyset(&act.sa_mask); | |
87 act.sa_flags = SA_RESTART | SA_SIGINFO; | 88 act.sa_flags = SA_RESTART | SA_SIGINFO; |
88 sigemptyset(&act.sa_mask); | 89 int r = sigaction(SIGPROF, &act, NULL); |
89 // TODO(johnmccutchan): Do we care about restoring the signal handler? | |
90 struct sigaction old_act; | |
91 int r = sigaction(SIGPROF, &act, &old_act); | |
92 ASSERT(r == 0); | 90 ASSERT(r == 0); |
93 } | 91 } |
94 | 92 |
93 | |
94 void SignalHandler::Remove() { | |
95 // Ignore future SIGPROF signals because by default SIGPROF will terminate | |
96 // the process and we may have some signals in flight. | |
97 struct sigaction act; | |
98 memset(&act, 0, sizeof(act)); | |
99 act.sa_handler = SIG_IGN; | |
100 sigemptyset(&act.sa_mask); | |
101 int r = sigaction(SIGPROF, &act, NULL); | |
102 ASSERT(r == 0); | |
103 } | |
siva
2015/04/07 18:18:07
The normal protocol is to remember the old action
Cutch
2015/04/07 18:35:55
The default SIGPROF handler terminates the process
| |
104 | |
95 | 105 |
96 } // namespace dart | 106 } // namespace dart |
97 | 107 |
98 #endif // defined(TARGET_OS_ANDROID) | 108 #endif // defined(TARGET_OS_ANDROID) |
OLD | NEW |