Your message dated Mon, 24 Jul 2017 13:24:05 +0200
with message-id <68ea0744-1db5-30a7-3d49-eebd97fce...@debian.org>
and subject line fixed in 9~b179-1
has caused the Debian Bug report #841173,
regarding openjdk-9: FTBFS on mips*
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
841173: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841173
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Source: openjdk-9
Version: 9~b139-1
Severity: important
Tags: patch

Hi,

openjdk-9 FTBFS on mips* with the error:

/«PKGBUILDDIR»/src/hotspot/src/os/linux/vm/jsig.c:47:2: error: #error
"Not all signals can be encoded in jvmsigs. Adapt its type!"
 #error "Not all signals can be encoded in jvmsigs. Adapt its type!"
  ^~~~~

This is because MIPS has 128 signals which the code added to OpenJDK 9
does not take into account. The attached patch fixes this by using
sigset_t to store the list of signals used by the JVM.

The patch was originally written for 9~b139-1, but I'm running another
build now for 9~b140-1 and I will let you know how it goes
(unfortunately it takes ages).

Thanks,
James
Description: Use sigset_t to store the signals used by the JVM
 On mips there are 128 signals so uint64_t is not big enough to store all of
 them. Replace the current method of storing the signals with a sigset_t which
 will work on all architectures.
Author: James Cowgill <jcowg...@debian.org>

diff -u b/hotspot/src/os/linux/vm/jsig.c b/hotspot/src/os/linux/vm/jsig.c
--- b/hotspot/src/os/linux/vm/jsig.c
+++ b/hotspot/src/os/linux/vm/jsig.c
@@ -41,13 +41,8 @@
 #define true 1
 #define false 0
 
-#define MASK(sig) ((uint64_t)1 << (sig-1))  // 0 is not a signal.
-// Check whether all signals fit into jvmsigs. -1 as MASK shifts by -1.
-#if (64 < NSIG-1)
-#error "Not all signals can be encoded in jvmsigs. Adapt its type!"
-#endif
 static struct sigaction sact[NSIG]; /* saved signal handlers */
-static uint64_t jvmsigs = 0; /* signals used by jvm */
+static sigset_t jvmsigs; /* signals used by jvm */
 
 /* used to synchronize the installation of signal handlers */
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -65,6 +60,11 @@
 static bool jvm_signal_installing = false;
 static bool jvm_signal_installed = false;
 
+static __attribute__((constructor)) void jvmsigs_init(void)
+{
+    sigemptyset(&jvmsigs);
+}
+
 static void signal_lock() {
   pthread_mutex_lock(&mutex);
   /* When the jvm is installing its set of signal handlers, threads
@@ -110,7 +110,7 @@
 
   signal_lock();
 
-  sigused = (sig < NSIG) && ((MASK(sig) & jvmsigs) != 0);
+  sigused = (sig < NSIG) && sigismember(&jvmsigs, sig);
   if (jvm_signal_installed && sigused) {
     /* jvm has installed its signal handler for this signal. */
     /* Save the handler. Don't really install it. */
@@ -127,7 +127,7 @@
     save_signal_handler(sig, oldhandler);
 
     /* Record the signals used by jvm */
-    jvmsigs |= MASK(sig);
+    sigaddset(&jvmsigs, sig);
 
     signal_unlock();
     return oldhandler;
@@ -168,7 +168,7 @@
 
   signal_lock();
 
-  sigused = (sig < NSIG) && ((MASK(sig) & jvmsigs) != 0);
+  sigused = (sig < NSIG) && sigismember(&jvmsigs, sig);
   if (jvm_signal_installed && sigused) {
     /* jvm has installed its signal handler for this signal. */
     /* Save the handler. Don't really install it. */
@@ -191,7 +191,7 @@
     }
 
     /* Record the signals used by jvm */
-    jvmsigs |= MASK(sig);
+    sigaddset(&jvmsigs, sig);
 
     signal_unlock();
     return res;
@@ -223,7 +223,7 @@
 
 struct sigaction *JVM_get_signal_action(int sig) {
   /* Does race condition make sense here? */
-  if ((MASK(sig) & jvmsigs) != 0) {
+  if (sigismember(&jvmsigs, sig)) {
     return &sact[sig];
   }
   return NULL;
only in patch2:
unchanged:
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -4206,14 +4206,16 @@ bool os::Linux::signal_handlers_are_inst
 
 // For signal-chaining
 struct sigaction sigact[NSIG];
-uint64_t sigs = 0;
-#if (64 < NSIG-1)
-#error "Not all signals can be encoded in sigs. Adapt its type!"
-#endif
+sigset_t sigs;
 bool os::Linux::libjsig_is_loaded = false;
 typedef struct sigaction *(*get_signal_t)(int);
 get_signal_t os::Linux::get_signal_action = NULL;
 
+static __attribute__((constructor)) void sigs_init()
+{
+    sigemptyset(&sigs);
+}
+
 struct sigaction* os::Linux::get_chained_signal_action(int sig) {
   struct sigaction *actp = NULL;
 
@@ -4288,7 +4290,7 @@ bool os::Linux::chained_handler(int sig,
 }
 
 struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
-  if ((((uint64_t)1 << (sig-1)) & sigs) != 0) {
+  if (sigismember(&sigs, sig)) {
     return &sigact[sig];
   }
   return NULL;
@@ -4297,7 +4299,7 @@ struct sigaction* os::Linux::get_preinst
 void os::Linux::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
   assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
   sigact[sig] = oldAct;
-  sigs |= (uint64_t)1 << (sig-1);
+  sigaddset(&sigs, sig);
 }
 
 // for diagnostic

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
--- Begin Message ---
Version: 9~b179-1

--- End Message ---

Reply via email to