1 /* darwin-signal.h - Catch runtime signals and turn them into exceptions, 2 on a Darwin system. */ 3 4 /* Copyright (C) 2004 Free Software Foundation 5 6 This file is part of libgcj. 7 8 This software is copyrighted work licensed under the terms of the 9 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for 10 details. */ 11 12 /* This file is really more of a specification. The rest of the system 13 should be arranged so that this Just Works. */ 14 15 #ifndef JAVA_SIGNAL_H 16 # define JAVA_SIGNAL_H 1 17 18 #include <sys/types.h> 19 #include <stdio.h> 20 #include <signal.h> 21 22 typedef void (* SIG_PF)(int); 23 24 # define HANDLE_SEGV 1 25 # undef HANDLE_FPE 26 27 # define SIGNAL_HANDLER(_name) \ 28 static void _name (int _dummy __attribute__ ((unused))) 29 30 # define MAKE_THROW_FRAME(_exception) 31 32 # define INIT_SEGV \ 33 do { \ 34 struct sigaction sa; \ 35 sa.sa_handler = catch_segv; \ 36 sigemptyset (&sa.sa_mask); \ 37 sa.sa_flags = SA_NODEFER; \ 38 sigaction (SIGBUS, &sa, NULL); \ 39 sigaction (SIGSEGV, &sa, NULL); \ 40 } while (0) 41 42 # define INIT_FPE \ 43 do { \ 44 struct sigaction sa; \ 45 sa.sa_handler = catch_fpe; \ 46 sigemptyset (&sa.sa_mask); \ 47 sa.sa_flags = SA_NODEFER; \ 48 sigaction (SIGFPE, &sa, NULL); \ 49 } while (0) 50 51 #endif /* JAVA_SIGNAL_H */ 52