OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <pthread.h> | 6 #include <pthread.h> |
7 #include <signal.h> | 7 #include <signal.h> |
8 | 8 |
9 #include "components/nacl/loader/nonsfi/irt_interfaces.h" | 9 #include "components/nacl/loader/nonsfi/irt_interfaces.h" |
10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 if (signal_handler_function_pointer) { | 42 if (signal_handler_function_pointer) { |
43 NaClSignalContext signal_context; | 43 NaClSignalContext signal_context; |
44 NaClSignalContextFromHandler(&signal_context, uc); | 44 NaClSignalContextFromHandler(&signal_context, uc); |
45 NaClExceptionFrame exception_frame; | 45 NaClExceptionFrame exception_frame; |
46 NaClSignalSetUpExceptionFrame(&exception_frame, | 46 NaClSignalSetUpExceptionFrame(&exception_frame, |
47 &signal_context, | 47 &signal_context, |
48 0 /* context_user_addr, | 48 0 /* context_user_addr, |
49 not useful for NonSFI NaCl. */); | 49 not useful for NonSFI NaCl. */); |
50 signal_handler_function_pointer(&exception_frame.context); | 50 signal_handler_function_pointer(&exception_frame.context); |
51 } | 51 } |
52 _exit(-1); | 52 _exit(-sig); |
53 } | 53 } |
54 | 54 |
55 int IrtExceptionHandler(NaClExceptionHandler handler, | 55 int IrtExceptionHandler(NaClExceptionHandler handler, |
56 NaClExceptionHandler* old_handler) { | 56 NaClExceptionHandler* old_handler) { |
57 pthread_mutex_lock(&mutex); | 57 pthread_mutex_lock(&mutex); |
58 if (old_handler) | 58 if (old_handler) |
59 *old_handler = signal_handler_function_pointer; | 59 *old_handler = signal_handler_function_pointer; |
60 signal_handler_function_pointer = handler; | 60 signal_handler_function_pointer = handler; |
61 pthread_mutex_unlock(&mutex); | 61 pthread_mutex_unlock(&mutex); |
62 return 0; | 62 return 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Install all handlers. | 102 // Install all handlers. |
103 for (a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) { | 103 for (a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) { |
104 if (sigaction(kSignals[a], &sa, NULL) != 0) | 104 if (sigaction(kSignals[a], &sa, NULL) != 0) |
105 NaClLog(LOG_FATAL, "sigaction to register signals failed.\n"); | 105 NaClLog(LOG_FATAL, "sigaction to register signals failed.\n"); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 } // namespace nonsfi | 109 } // namespace nonsfi |
110 } // namespace nacl | 110 } // namespace nacl |
OLD | NEW |