Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: src/trusted/service_runtime/linux/nacl_signal.c

Issue 1159803003: Add SIGHUP and SIGTERM handlers in NaCl. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698