19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
|
24 #define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h |
24 #include <stdio.h> |
25 #include <stdio.h> |
25 #include <jni.h> |
26 #include <jni.h> |
26 #define __USE_GNU |
|
27 #include <signal.h> |
27 #include <signal.h> |
28 #include <sys/ucontext.h> |
28 #include <sys/ucontext.h> |
29 |
29 |
30 #ifdef __cplusplus |
30 #ifdef __cplusplus |
31 extern "C" { |
31 extern "C" { |
40 } |
40 } |
41 |
41 |
42 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { |
42 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) { |
43 struct sigaction act; |
43 struct sigaction act; |
44 struct sigaction oact; |
44 struct sigaction oact; |
45 pthread_attr_t attr; |
|
46 stack_t stack; |
|
47 |
45 |
48 act.sa_flags = SA_ONSTACK|SA_RESTART|SA_SIGINFO; |
46 act.sa_flags = SA_ONSTACK|SA_RESTART|SA_SIGINFO; |
49 sigfillset(&act.sa_mask); |
47 sigfillset(&act.sa_mask); |
50 act.sa_handler = SIG_DFL; |
48 act.sa_handler = SIG_DFL; |
51 act.sa_sigaction = (void (*)())sig_handler; |
49 act.sa_sigaction = (void (*)())sig_handler; |