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 25 matching lines...) Expand all Loading... | |
36 * The signals listed here should either be handled by NaCl (or otherwise | 36 * The signals listed here should either be handled by NaCl (or otherwise |
37 * trusted code). | 37 * trusted code). |
38 */ | 38 */ |
39 static int s_Signals[] = { | 39 static int s_Signals[] = { |
40 #if NACL_ARCH(NACL_BUILD_ARCH) != NACL_mips | 40 #if NACL_ARCH(NACL_BUILD_ARCH) != NACL_mips |
41 /* This signal does not exist on MIPS. */ | 41 /* This signal does not exist on MIPS. */ |
42 SIGSTKFLT, | 42 SIGSTKFLT, |
43 #endif | 43 #endif |
44 SIGSYS, /* Used to support a seccomp-bpf sandbox. */ | 44 SIGSYS, /* Used to support a seccomp-bpf sandbox. */ |
45 NACL_THREAD_SUSPEND_SIGNAL, | 45 NACL_THREAD_SUSPEND_SIGNAL, |
46 SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV, | 46 SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGBUS, SIGFPE, SIGSEGV, SIGTERM, |
Mark Seaborn
2015/06/04 19:44:05
Nit: your commit message says you're adding SIGINT
| |
47 /* Handle SIGABRT in case someone sends it asynchronously using kill(). */ | 47 /* Handle SIGABRT in case someone sends it asynchronously using kill(). */ |
48 SIGABRT | 48 SIGABRT |
49 }; | 49 }; |
50 | 50 |
51 static struct sigaction s_OldActions[NACL_ARRAY_SIZE_UNSAFE(s_Signals)]; | 51 static struct sigaction s_OldActions[NACL_ARRAY_SIZE_UNSAFE(s_Signals)]; |
52 | 52 |
53 static NaClSignalHandler g_handler_func; | 53 static NaClSignalHandler g_handler_func; |
54 | 54 |
55 void NaClSignalHandlerSet(NaClSignalHandler func) { | 55 void NaClSignalHandlerSet(NaClSignalHandler func) { |
56 g_handler_func = func; | 56 g_handler_func = func; |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 unsigned int a; | 447 unsigned int a; |
448 | 448 |
449 /* Remove all handlers */ | 449 /* Remove all handlers */ |
450 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { | 450 for (a = 0; a < NACL_ARRAY_SIZE(s_Signals); a++) { |
451 if (sigaction(s_Signals[a], &s_OldActions[a], NULL) != 0) { | 451 if (sigaction(s_Signals[a], &s_OldActions[a], NULL) != 0) { |
452 NaClLog(LOG_FATAL, "Failed to unregister handler for %d.\n\tERR:%s\n", | 452 NaClLog(LOG_FATAL, "Failed to unregister handler for %d.\n\tERR:%s\n", |
453 s_Signals[a], strerror(errno)); | 453 s_Signals[a], strerror(errno)); |
454 } | 454 } |
455 } | 455 } |
456 } | 456 } |
OLD | NEW |