static void check_reserved_signal_(const char *name, size_t name_len) { const char *prev = ATOMIC_PTR_EXCHANGE(received_signal, name); if (prev) { ssize_t RB_UNUSED_VAR(err); #define NOZ(name, str) name[sizeof(str)-1] = str static const char NOZ(msg1, " received in "); static const char NOZ(msg2, " handler\n"); #ifdef HAVE_WRITEV struct iovec iov[4]; iov[0].iov_base = (void *)name; iov[0].iov_len = name_len; iov[1].iov_base = (void *)msg1; iov[1].iov_len = sizeof(msg1); iov[2].iov_base = (void *)prev; iov[2].iov_len = strlen(prev); iov[3].iov_base = (void *)msg2; iov[3].iov_len = sizeof(msg2); err = writev(2, iov, 4); #else err = write(2, name, name_len); err = write(2, msg1, sizeof(msg1)); err = write(2, prev, strlen(prev)); err = write(2, msg2, sizeof(msg2)); #endif ruby_abort(); } ruby_disable_gc = 1; }
static RETSIGTYPE sigsegv(int sig SIGINFO_ARG) { if (segv_received) { ssize_t RB_UNUSED_VAR(err); static const char msg[] = "SEGV received in SEGV handler\n"; err = write(2, msg, sizeof(msg)); ruby_abort(); } CHECK_STACK_OVERFLOW(); segv_received = 1; ruby_disable_gc = 1; rb_bug_context(SIGINFO_CTX, "Segmentation fault" MESSAGE_FAULT_ADDRESS); }
static RETSIGTYPE sigsegv(int sig SIGINFO_ARG) { if (segv_received) { ssize_t RB_UNUSED_VAR(err); char msg[] = "SEGV received in SEGV handler\n"; err = write(2, msg, sizeof(msg)); ruby_abort(); } CHECK_STACK_OVERFLOW(); segv_received = 1; ruby_disable_gc_stress = 1; rb_bug("Segmentation fault"); }