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

Side by Side Diff: src/nonsfi/linux/irt_exception_handling.c

Issue 1184233002: Exit with -sig when handling signals. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 years, 6 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) 2014 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2014 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 <pthread.h> 8 #include <pthread.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 #endif 189 #endif
190 } 190 }
191 191
192 /* Signal handler, responsible for calling the registered handler. */ 192 /* Signal handler, responsible for calling the registered handler. */
193 static void signal_catch(int sig, linux_siginfo_t *info, void *uc) { 193 static void signal_catch(int sig, linux_siginfo_t *info, void *uc) {
194 if (g_signal_handler_function_pointer) { 194 if (g_signal_handler_function_pointer) {
195 struct NonSfiExceptionFrame exception_frame; 195 struct NonSfiExceptionFrame exception_frame;
196 exception_frame_from_signal_context(&exception_frame, uc); 196 exception_frame_from_signal_context(&exception_frame, uc);
197 g_signal_handler_function_pointer(&exception_frame.context); 197 g_signal_handler_function_pointer(&exception_frame.context);
198 } 198 }
199 _exit(-1); 199 _exit(-sig);
200 } 200 }
201 201
202 static void nonsfi_initialize_signal_handler_locked() { 202 static void nonsfi_initialize_signal_handler_locked() {
203 struct linux_sigaction sa; 203 struct linux_sigaction sa;
204 unsigned int a; 204 unsigned int a;
205 205
206 memset(&sa, 0, sizeof(sa)); 206 memset(&sa, 0, sizeof(sa));
207 sa.sa_sigaction = signal_catch; 207 sa.sa_sigaction = signal_catch;
208 sa.sa_flags = LINUX_SA_SIGINFO | LINUX_SA_ONSTACK; 208 sa.sa_flags = LINUX_SA_SIGINFO | LINUX_SA_ONSTACK;
209 209
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (linux_sigprocmask(LINUX_SIG_UNBLOCK, &mask, NULL) != 0) 286 if (linux_sigprocmask(LINUX_SIG_UNBLOCK, &mask, NULL) != 0)
287 abort(); 287 abort();
288 288
289 return 0; 289 return 0;
290 } 290 }
291 291
292 int nacl_exception_set_stack(void *p, size_t s) { 292 int nacl_exception_set_stack(void *p, size_t s) {
293 /* Not implemented yet. */ 293 /* Not implemented yet. */
294 return ENOSYS; 294 return ENOSYS;
295 } 295 }
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