< prev index next >
src/java.base/unix/native/libjsig/jsig.c
Print this page
@@ -27,10 +27,22 @@
* libthread to interpose the signal handler installation functions:
* sigaction(), signal(), sigset().
* Used for signal-chaining. See RFE 4381843.
*/
+#include "jni.h"
+
+#ifdef SOLARIS
+/* Our redeclarations of the system functions must not have a less
+ * restrictive linker scoping, so we have to declare them as JNIEXPORT
+ * before including signal.h */
+#include "sys/signal.h"
+JNIEXPORT void (*signal(int sig, void (*disp)(int)))(int);
+JNIEXPORT void (*sigset(int sig, void (*disp)(int)))(int);
+JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
+#endif
+
#include <dlfcn.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
@@ -206,20 +218,20 @@
signal_unlock();
return oldhandler;
}
}
-sa_handler_t signal(int sig, sa_handler_t disp) {
+JNIEXPORT sa_handler_t signal(int sig, sa_handler_t disp) {
if (sig < 0 || sig >= MAX_SIGNALS) {
errno = EINVAL;
return SIG_ERR;
}
return set_signal(sig, disp, false);
}
-sa_handler_t sigset(int sig, sa_handler_t disp) {
+JNIEXPORT sa_handler_t sigset(int sig, sa_handler_t disp) {
#ifdef _ALLBSD_SOURCE
printf("sigset() is not supported by BSD");
exit(0);
#else
if (sig < 0 || sig >= MAX_SIGNALS) {
@@ -241,11 +253,11 @@
}
}
return (*os_sigaction)(sig, act, oact);
}
-int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
+JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
int res;
bool sigused;
struct sigaction oldAct;
if (sig < 0 || sig >= MAX_SIGNALS) {
< prev index next >