static void initialize_signal_handler() { # ifdef NEED_OSX_MACH_HANDLER macosx_init_exception_handler(); # endif # ifdef NEED_SIGACTION { struct sigaction act, oact; memset(&act, 0, sizeof(sigaction)); act.sa_sigaction = fault_handler; sigemptyset(&act.sa_mask); /* In MzScheme, SIGCHLD or SIGINT handling may trigger a write barrier: */ sigaddset(&act.sa_mask, SIGINT); sigaddset(&act.sa_mask, SIGCHLD); act.sa_flags = SA_SIGINFO; sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact); } # endif # ifdef NEED_SIGWIN { HMODULE hm; PVOID (WINAPI*aveh)(ULONG, gcPVECTORED_EXCEPTION_HANDLER); hm = LoadLibrary("kernel32.dll"); if (hm) aveh = (PVOID (WINAPI*)(ULONG, gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "AddVectoredExceptionHandler"); else aveh = NULL; if (aveh) aveh(TRUE, fault_handler); else generations_available = 0; } # endif }
static void initialize_signal_handler(GCTYPE *gc) { # ifdef NEED_OSX_MACH_HANDLER # if defined(MZ_USE_PLACES) && defined(MZ_PRECISE_GC) macosx_init_exception_handler(MASTERGC == 0); # else macosx_init_exception_handler(1); # endif # endif # ifdef NEED_SIGSTACK { stack_t ss; uintptr_t sz = 10*SIGSTKSZ; ss.ss_sp = malloc(sz); ss.ss_size = sz; ss.ss_flags = 0; sigaltstack(&ss, NULL); } # endif # ifdef NEED_SIGACTION { struct sigaction act, oact; memset(&act, 0, sizeof(act)); act.sa_sigaction = fault_handler; sigemptyset(&act.sa_mask); /* In Racket, SIGCHLD or SIGINT handling may trigger a write barrier: */ sigaddset(&act.sa_mask, SIGINT); sigaddset(&act.sa_mask, SIGCHLD); act.sa_flags = SA_SIGINFO; # ifdef NEED_SIGSTACK act.sa_flags |= SA_ONSTACK; # endif sigaction(USE_SIGACTON_SIGNAL_KIND, &act, &oact); # ifdef USE_ANOTHER_SIGACTON_SIGNAL_KIND sigaction(USE_ANOTHER_SIGACTON_SIGNAL_KIND, &act, &oact); # endif } # endif # ifdef NEED_SIGWIN { HMODULE hm; PVOID (WINAPI*aveh)(ULONG, gcPVECTORED_EXCEPTION_HANDLER); hm = LoadLibrary("kernel32.dll"); if (hm) aveh = (PVOID (WINAPI*)(ULONG, gcPVECTORED_EXCEPTION_HANDLER))GetProcAddress(hm, "AddVectoredExceptionHandler"); else aveh = NULL; if (aveh) aveh(TRUE, fault_handler); else /* older than Windows XP */ gc->generations_available = 0; } # endif }