OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2015 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 */ | 470 */ |
471 memset(&mask, 0, sizeof(mask)); | 471 memset(&mask, 0, sizeof(mask)); |
472 | 472 |
473 /* | 473 /* |
474 * Hack to be able to reuse sigset_t utilities from newlib for the | 474 * Hack to be able to reuse sigset_t utilities from newlib for the |
475 * first lower 4 bytes of the signal, works because we are all | 475 * first lower 4 bytes of the signal, works because we are all |
476 * little endians. | 476 * little endians. |
477 */ | 477 */ |
478 sigset_t *maskptr = (sigset_t *) &mask; | 478 sigset_t *maskptr = (sigset_t *) &mask; |
479 sigemptyset(maskptr); | 479 sigemptyset(maskptr); |
480 for (int a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) { | 480 for (size_t a = 0; a < NACL_ARRAY_SIZE(kSignals); a++) { |
481 if (sigaddset(maskptr, kSignals[a]) != 0) | 481 if (sigaddset(maskptr, kSignals[a]) != 0) |
482 abort(); | 482 abort(); |
483 } | 483 } |
484 if (linux_sigprocmask(LINUX_SIG_UNBLOCK, &mask, NULL) != 0) | 484 if (linux_sigprocmask(LINUX_SIG_UNBLOCK, &mask, NULL) != 0) |
485 abort(); | 485 abort(); |
486 | 486 |
487 return 0; | 487 return 0; |
488 } | 488 } |
489 | 489 |
490 int nacl_exception_set_stack(void *p, size_t s) { | 490 int nacl_exception_set_stack(void *p, size_t s) { |
(...skipping 13 matching lines...) Expand all Loading... |
504 | 504 |
505 int nacl_async_signal_send_async_signal(nacl_irt_tid_t tid) { | 505 int nacl_async_signal_send_async_signal(nacl_irt_tid_t tid) { |
506 if (!g_signal_handler_initialized) | 506 if (!g_signal_handler_initialized) |
507 return ESRCH; | 507 return ESRCH; |
508 if (tid == 0) | 508 if (tid == 0) |
509 tid = g_main_tid; | 509 tid = g_main_tid; |
510 if (linux_tgkill(g_tgid, tid, LINUX_SIGUSR1) == -1) | 510 if (linux_tgkill(g_tgid, tid, LINUX_SIGUSR1) == -1) |
511 return errno; | 511 return errno; |
512 return 0; | 512 return 0; |
513 } | 513 } |
OLD | NEW |