summaryrefslogtreecommitdiff
path: root/java/openjdk7/files/patch-src-solaris-native-sun-nio-ch-NativeThread.c
blob: 93216af25d73c0a2aed4c3d11f7b5c066bef9c53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+++ jdk/src/solaris/native/sun/nio/ch/NativeThread.c
@@ -33,12 +33,20 @@
 #include "nio_util.h"
 
 
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
+#if defined(__linux__)
 #include <pthread.h>
 #include <sys/signal.h>
 
 /* Also defined in src/solaris/native/java/net/linux_close.c */
 #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+#else
+#include <pthread.h>
+#include <signal.h>
+
+/* Also defined in src/solaris/native/java/net/bsd_close.c */
+#define INTERRUPT_SIGNAL SIGIO
+#endif
 
 static void
 nullHandler(int sig)
@@ -51,7 +59,7 @@
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
 
     /* Install the null handler for INTERRUPT_SIGNAL.  This might overwrite the
      * handler previously installed by java/net/linux_close.c, but that's okay
@@ -74,7 +82,7 @@
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
     return (long)pthread_self();
 #else
     return -1;
@@ -84,7 +92,7 @@
 JNIEXPORT void JNICALL
 Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
 {
-#ifdef __linux__
+#if defined(__linux__) || defined(_ALLBSD_SOURCE)
     if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
         JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
 #endif