| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 struct sigaction sa; | 350 struct sigaction sa; |
| 351 unsigned int a; | 351 unsigned int a; |
| 352 | 352 |
| 353 memset(&sa, 0, sizeof(sa)); | 353 memset(&sa, 0, sizeof(sa)); |
| 354 sigemptyset(&sa.sa_mask); | 354 sigemptyset(&sa.sa_mask); |
| 355 sa.sa_sigaction = SignalCatch; | 355 sa.sa_sigaction = SignalCatch; |
| 356 sa.sa_flags = SA_ONSTACK | SA_SIGINFO; | 356 sa.sa_flags = SA_ONSTACK | SA_SIGINFO; |
| 357 | 357 |
| 358 /* Mask all exceptions we catch to prevent re-entry */ | 358 /* Mask all exceptions we catch to prevent re-entry */ |
| 359 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { | 359 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { |
| 360 sigaddset(&sa.sa_mask, s_Signals[a]); | 360 if (s_Signals[a] != NACL_THREAD_SUSPEND_SIGNAL) { |
| 361 sigaddset(&sa.sa_mask, s_Signals[a]); |
| 362 } |
| 361 } | 363 } |
| 362 | 364 |
| 363 /* Install all handlers */ | 365 /* Install all handlers */ |
| 364 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { | 366 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { |
| 365 if (sigaction(s_Signals[a], &sa, &s_OldActions[a]) != 0) { | 367 if (sigaction(s_Signals[a], &sa, &s_OldActions[a]) != 0) { |
| 366 NaClLog(LOG_FATAL, "Failed to install handler for %d.\n\tERR:%s\n", | 368 NaClLog(LOG_FATAL, "Failed to install handler for %d.\n\tERR:%s\n", |
| 367 s_Signals[a], strerror(errno)); | 369 s_Signals[a], strerror(errno)); |
| 368 } | 370 } |
| 369 } | 371 } |
| 370 } | 372 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 399 } | 401 } |
| 400 if ((sa.sa_flags & SA_SIGINFO) != 0 | 402 if ((sa.sa_flags & SA_SIGINFO) != 0 |
| 401 ? sa.sa_sigaction != NULL | 403 ? sa.sa_sigaction != NULL |
| 402 : (sa.sa_handler != SIG_DFL && sa.sa_handler != SIG_IGN)) { | 404 : (sa.sa_handler != SIG_DFL && sa.sa_handler != SIG_IGN)) { |
| 403 NaClLog(LOG_FATAL, "NaClSignalAssertNoHandlers: " | 405 NaClLog(LOG_FATAL, "NaClSignalAssertNoHandlers: " |
| 404 "A signal handler is registered for signal %d. " | 406 "A signal handler is registered for signal %d. " |
| 405 "Did Breakpad register this?\n", signum); | 407 "Did Breakpad register this?\n", signum); |
| 406 } | 408 } |
| 407 } | 409 } |
| 408 } | 410 } |
| OLD | NEW |