| 55 | }; |
| 56 | |
| 57 | int raise(int sig) { |
| 58 | if (__sig_is_blocked(sig)) { |
| 59 | sigaddset(&__sig_pending, sig); |
| 60 | return 0; |
| 61 | } |
| 62 | if (__sig_actions[sig].sa_flags & SA_SIGINFO) { |
| 63 | siginfo_t t = {0}; |
| 64 | __sig_actions[sig].sa_sigaction(sig, &t, NULL); |
| 65 | } else { |
| 66 | sighandler_t handler = __sig_actions[sig].sa_handler; |
| 67 | if (handler == SIG_DFL) { |
| 68 | handler = default_actions[sig]; |
| 69 | if (handler) { |
| 70 | handler(sig); |
| 71 | } |
| 72 | } else if (handler != SIG_IGN) { |
| 73 | // Avoid a direct call to the handler, and instead call via JS so we can |
| 74 | // avoid strict signature checking. |
| 75 | // https://github.com/emscripten-core/posixtestsuite/issues/6 |
| 76 | __call_sighandler(handler, sig); |
| 77 | } |
| 78 | } |
| 79 | return 0; |
| 80 | } |