2014-04-11 Marc Glisse <marc.glisse@inria.fr>
[official-gcc.git] / libjava / include / pa-signal.h
blobadd132517376e516d3a7440803460c064a815fba
1 // pa-signal.h - Catch runtime signals and turn them into exceptions.
3 /* Copyright (C) 1998, 1999, 2000, 2009 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 #ifndef JAVA_SIGNAL_H
12 #define JAVA_SIGNAL_H 1
14 #include <signal.h>
15 #include <sys/syscall.h>
17 #define HANDLE_SEGV 1
18 #define HANDLE_FPE 1
20 #define SIGNAL_HANDLER(_name) \
21 static void _Jv_##_name (int _dummy __attribute__ ((unused)), \
22 siginfo_t *_info __attribute__ ((__unused__)), \
23 void *arg __attribute__ ((__unused__)))
25 #define MAKE_THROW_FRAME(_exception)
27 #define INIT_SEGV \
28 do \
29 { \
30 struct sigaction act; \
31 act.sa_sigaction = _Jv_catch_segv; \
32 sigemptyset (&act.sa_mask); \
33 act.sa_flags = SA_SIGINFO; \
34 syscall (SYS_rt_sigaction, SIGSEGV, &act, NULL, _NSIG / 8); \
35 } \
36 while (0)
38 #define INIT_FPE \
39 do \
40 { \
41 struct sigaction act; \
42 act.sa_sigaction = _Jv_catch_fpe; \
43 sigemptyset (&act.sa_mask); \
44 act.sa_flags = SA_SIGINFO; \
45 syscall (SYS_rt_sigaction, SIGFPE, &act, NULL, _NSIG / 8); \
46 } \
47 while (0)
49 #endif /* JAVA_SIGNAL_H */